npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

poeditor-connector

v1.0.3

Published

Plugin For Posting XMB and Retreiving XTB messages from poeditor.com

Downloads

94

Readme

npm version

poeditor-connector

Connect javascript applications with poeditor.com for easy internationalization support.

Can be used to upload XMB message files generated from Angular2 i18n process and download translated XTB files suitable for bundling.

Install with npm through published version on npmjs.org

npm install poeditor-connector --save

Requirements

Requires that you set up a project on poeditor.com and generate an API key. Instructions are available on their API reference

Angular i18n

This project was written specifically to connect an Angular typescript application to poeditor.com for use with the XMB message format.

The Angular documentation on i18n focuses on the XLIFF format, but poeditor.com only supports XMB. XMB is used heavily inside of Google, but is not well documented externally. Note that XMB is the file format for messageterms that have been extracted from the application. XTB is the related file format for the translation output that is actually bunded in the application.

Configuration

A sample config file is included in the project under config/poeditor.sample.json. This will need to be modified to support your preferred settings

  • apiToken : poeditor.com api token
  • projectId : poeditor.com projectId
  • importFile : relative location of the terms to be posted to the api
  • importUpdating : terms | terms_translations | translations
  • importLanguage (optional) : the language code (required only if updating is terms_translations or translations)
  • importOverwrite (optional) : set it to 1 if you want to overwrite translations
  • importSyncTerms (optional) : whether or not to delete terms from the project not found in the import file when uploading
  • importFuzzyTrigger (optional) : set it to 1 if you want to sync your terms (terms that are not found in the uploaded file will be deleted from project and the new ones added). Ignored if updating = translations.
  • importTags (optional) : add tags to the project terms; available when updating terms or terms_translations; you can use the following keys: "all" - for the all the imported terms, "new" - for the terms which aren't already in the project, "obsolete" - for the terms which are in the project but not in the imported file and "overwritten_translations" - for the terms for which translations change
  • exportDir : local directory to download translated files
  • exportFiles : hash map of languages to download and the file name to use
  • exportFilters (optional): filter results by 'translated', 'untranslated', 'fuzzy', 'not_fuzzy', 'automatic', 'not_automatic', 'proofread', 'not_proofread' (only available when Proofreading is set to "Yes" in Project Settings); you can use either a string for a single filter or a json array for one or multiple filter
  • exportTags (optional): filter results by tags; you can use either a string for a single tag or a json array for one or multiple tags
{
  "apiToken":"REPLACE_WITH_YOUR_API_TOKEN",
  "projectId":"REPLACE_WITH_YOUR_PROJECT_ID",
  "importFile":"spec/messages.xmb",
  "importSyncTerms": 1,
  "exportDir":"locale",
  "exportFiles":{
    "en":"messages.en.xtb",
    "tl":"messages.tl.xtb",
    "zh-CN":"messages.zh.xtb"
  }
}

Usage

Use from npm package.json:

{
  "scripts": {
    "i18n": "npm run compile:aot && ng-xi18n --i18nFormat=xmb && npm run i18n:poeditor",
    "i18n:poeditor": "poeditor --config=./config/poeditor.json" 
  }
}

invoke from the shell

npm run i18n

License

MIT. Copyright (c) 2020 Jon Marston.