Command line application for POEditor.
- 📚 Exporting translation files directly from POEditor to your project directory
- 🎲 Mapping translation directory dynamically
- 🍎 Replacing
%s
with%@
for Apple strings - 📦 We use it in our products
$ [sudo] gem install poeditor-cli
A single command will do almost everything for you.
$ poeditor pull
Before 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.strings
See Example
poeditor.yml
files section for more examples.
-
api_key
Your POEditor API key. You can check it on POEditor API Access. Use such like
$MY_API_KEY
to 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_ID
to use environment variable. -
languages
Language codes to export. Use the language codes that your project uses. For example, use
zh-Hans
for Xcode project andzh-rCN
for Android project even though POEditor useszh-CN
for simplified chinese. -
language_alias (Optional)
Specify this value to copy the translation file to another language. For example,
zh
is same with the translation ofzh-Hans
orzh-rCN
. In this case, you can specify thelanguage_alias
value 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
languages
will be used for filling{LANGUAGE}
placeholder. -
path_replace (Optional)
Specify this value to enforce the translation file path. For example, Android uses
values/strings.xml
for default language andvalues-ko/strings.xml
orvalues-ja/strings.xml
for others. In this case, you can specify thepath_replace
as 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.