Command line application for POEditor.
- 📚 Exporting translation files directly from POEditor to your project directory
- 🎲 Mapping translation directory dynamically
- 🍎 Replacing
%swith%@for Apple strings - 📦 We use it in our products
$ [sudo] gem install poeditor-cliA single command will do almost everything for you.
$ poeditor pullBefore you do this, you have to create a poeditor.yml file. This is a configuration file for poeditor-cli. Here is an example poeditor.yml:
api_key: YOUR_API_KEY
project_id: PROJECT_ID
type: apple_strings
tags: [ios]
languages: [en, ko, ja, zh-Hans, zh-Hant, fr, es]
language_alias:
zh: zh-Hans
path: Resources/{LANGUAGE}.lproj/Localizable.strings
path_replace:
en: Resources/Base.lproj/Localizable.stringsSee Example
poeditor.ymlfiles section for more examples.
-
api_key
Your POEditor API key. You can check it on POEditor API Access. Use such like
$MY_API_KEYto use environment variable. -
project_id
POEditor project ID. You can check this value on the web browser's address bar. (For example:
https://poeditor.com/projects/view?id=XXXXX) Use such like$MY_PROJECT_IDto use environment variable. -
languages
Language codes to export. Use the language codes that your project uses. For example, use
zh-Hansfor Xcode project andzh-rCNfor Android project even though POEditor useszh-CNfor simplified chinese. -
language_alias (Optional)
Specify this value to copy the translation file to another language. For example,
zhis same with the translation ofzh-Hansorzh-rCN. In this case, you can specify thelanguage_aliasvalue as follows:languages: [ko, ja, zh-Hans, zh-Hant] language_alias: zh: zh-Hans
-
path
The path for translation files to be downloaded. Each values of
languageswill be used for filling{LANGUAGE}placeholder. -
path_replace (Optional)
Specify this value to enforce the translation file path. For example, Android uses
values/strings.xmlfor default language andvalues-ko/strings.xmlorvalues-ja/strings.xmlfor others. In this case, you can specify thepath_replaceas follows:path: myapp/src/main/res/values-{LANGUAGE}/strings.xml path_replace: en: myapp/src/main/res/values/strings.xml
-
type
Translation file format. (po, pot, mo, xls, csv, resw, resx, android_strings, apple_strings, xliff, properties, key_value_json, json, xmb, xtb)
-
tags (Optional)
Terms which contain whole tags will be exported. (
&&)
-
Xcode project
api_key: $POEDITOR_API_KEY # from envvar project_id: $POEDITOR_PROJECT_ID # from envvar type: apple_strings tags: [ios] languages: [en, ko, ja, zh-Hans, zh-Hant] path: Resources/{LANGUAGE}.lproj/Localizable.strings
-
Android project
api_key: $POEDITOR_API_KEY # from envvar project_id: $POEDITOR_PROJECT_ID # from envvar type: android_strings tags: [android] languages: [en, ko, ja, zh-rCN, zh-rTW] path: myapp/src/main/res/values-{LANGUAGE}/strings.xml path_replace: en: myapp/src/main/res/values/strings.xml
-
Projects using gettext
api_key: $POEDITOR_API_KEY # from envvar project_id: $POEDITOR_PROJECT_ID # from envvar type: po languages: [en, ko, ja, zh_Hans, zh_Hant] language_alias: zh: zh_Hans path: myservice/translations/{LANGUAGE}/LC_MESSAGES/messages.po
poeditor-cli is written by Suyeol Jeon and available under MIT license.
