POEditor scripts have been provided in order to speed up process of pulling new translations into mobile projects. They are written in Ruby, support both mobile platforms: Android, iOS and are intendend to be shared across them.
There are 2 ways to use provided functionality:
- Instantiating
PullCommandclass instance directly in your Ruby code and calling its methods accordingly to API. - Installing Ruby gem:
[sudo] gem install poeditor-pulland callingpoeditor-pullfrom command line with arguments and treating it as a black box with no need to write any line in Ruby to take advantage of it.
Both ways require preparing and providing POEditor config JSON file that defines project setup as shown in the example below:
{
"api_key": "$POEDITOR_API_KEY",
"project_id": 11111,
"type": "android_strings",
"languages": [
"en-us",
"en-gb",
"es",
"pt-Br"
],
"filters": [
"translated"
],
"path": "path/to/your/project/src/main/res/values-{LANGUAGE}/po_strings.xml",
"path_replace": {
"en-us": "path/to/your/project/src/main/res/values/po_strings.xml"
}
}
"api_key" can be defined directly in JSON or defined as environment variable: POEDITOR_API_KEY
"path" and "path_replace" paths can be defined as both: absolute and relative. If they are relative
you also need to define project main directory while initializing PullCommand class or calling
poeditor-pull script with -p parameter.
Usage: poeditor-pull [options]
-c, --config-path CONFIG_PATH Path to your POEditor JSON config
-p, --project-path PROJECT_PATH Path to your project's main directory [optional]
JSON supports defitions based on POEDitor v2 API like: type, tags, filters etc. For further information regarding that visit:
https://poeditor.com/docs/api and https://github.com/StyleShare/poeditor-cli (keep in mind YAML -> JSON change)
As it's stated in CHANGELOG - scripts are based on POEditor Ruby CLI tool: https://github.com/StyleShare/poeditor-cli
and support everything what's supported in v.0.5.0. In addition to that there were new functionalites implemented.
For more information regarding introduced adjustments please review CHANGELOG file.