1.2.0 • Published 3 years ago

@office_app/oa-poeditor-sync v1.2.0

Weekly downloads
1
License
ISC
Repository
gitlab
Last release
3 years ago

npm version

oa-poeditor-sync

oa-poeditor-sync is a simple node.js script to synchronize and post-process internationalization catalogs from POEditor.com

Published on npm at: https://www.npmjs.com/package/@office_app/oa-poeditor-sync

It downloads the JSON files, replaces iOS specific symbols with web symbols (newline to breaks, markdown to href, backslashes etc.) and writes the files to src/locales in your project.

The language catalogs from POEditor are shared amongst the webapp, iOS and Android. For this reason, a common denominator was chosen for translation string markup. iOS is the leading platform for this at Office App.

For web, we have to transform the following tokens:

  • \n (newline): <br /> (break)
  • [description](http://domain.com/) (markdown style link): <a href="http://domain.com/">description</a> (a href)
  • %@ (text placeholder): {1}
  • %d (integer): ??

See: https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-vue-app-with-vue-i18n

Update feb 2021

For vue-18n-next, some changes were required.

Most notably, the '@'-sign is no longer allowed in translations and has to be wrapped.

More info here: https://github.com/intlify/vue-i18n-next/issues/118

This is the reason sync-v2.js was created. This version will need to be called in projects using vue-i18n-next.

Installation

Install from npm:

$ npm i @office_app/oa-poeditor-sync -D

(or use yarn add @office_app/oa-poeditor-sync -D)

Usage

Set POEDITOR_API_TOKEN and POEDITOR_PROJECT_ID as environment variables.

Go to https://poeditor.com/ to get the values for both.

Then run:

$ npx oa-poeditor-sync

It should give output similar to:

Pulling Dutch (nl) with coverage 98% (1214 messages)
Pulling English (en) with coverage 100% (1232 messages)
Pulling French (fr) with coverage 100% (1232 messages)
Pulling German (de) with coverage 98% (1217 messages)
Pulling Italian (it) with coverage 98% (1216 messages)
Pulling Norwegian Bokmål (nb) with coverage 98% (1216 messages)
Locale file downloaded and post-processed: nl.
Locale file downloaded and post-processed: nb.
Locale file downloaded and post-processed: en.
Locale file downloaded and post-processed: de.
Locale file downloaded and post-processed: fr.
Locale file downloaded and post-processed: it.

When it's done, take a look in the src/locales/ directory of your project.

More info

Ask Gijs Nijholt (gijs at getofficeapp com)

https://www.getofficeapp.com/

1.2.0

3 years ago

1.1.0

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago