Skip to content

Commit 1bf58b9

Browse files
committed
Update README.md
1 parent 646c42c commit 1bf58b9

File tree

1 file changed

+103
-21
lines changed

1 file changed

+103
-21
lines changed

README.md

Lines changed: 103 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
Command line application for [POEditor](https://poeditor.com).
77

8-
<img width="682" alt="poeditor-cli" src="https://cloud.githubusercontent.com/assets/931655/22509884/2aebebc2-e8d3-11e6-86e2-a9915ca755b5.png">
8+
<img alt="poeditor-cli" src="https://cloud.githubusercontent.com/assets/931655/22522393/c6d3db32-e8fe-11e6-97f1-259445bc04d1.png" width="680">
99

1010
## Features
1111

1212
* Exporting translation files directly from POEditor to your project directory
1313
* Mapping translation directory dynamically
14-
* Replacing `%s` to `%@` for Apple strings
14+
* Replacing `%s` with `%@` for Apple strings
1515
* We use it on our products
1616

1717
## Installation
@@ -22,35 +22,117 @@ $ [sudo] gem install poeditor-cli
2222

2323
## Usage
2424

25-
1. **Create `poeditor.yml` file**
25+
A single command will do almost everything for you.
2626

27-
Here is an example.
27+
```console
28+
$ poeditor pull
29+
```
30+
31+
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`**:
32+
33+
```yaml
34+
api_key: YOUR_API_KEY
35+
project_id: PROJECT_ID
36+
type: apple_strings
37+
tags: [ios]
38+
39+
languages: [en, ko, ja, zh-Hans, zh-Hant, fr, es]
40+
language_alias:
41+
zh: zh-Hans
42+
43+
path: Resources/{LANGUAGE}.lproj/Localizable.strings
44+
path_replace:
45+
en: Resources/Base.lproj/Localizable.strings
46+
```
47+
48+
> See **[Example `poeditor.yml` files](#example-poeditoryml-files)** section for more examples.
49+
50+
* **api_key**
51+
52+
Your POEditor API key. You can check it on [POEditor API Access](https://poeditor.com/account/api). Use such like `$MY_API_KEY` to use environment variable.
53+
54+
* **project_id**
55+
56+
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.
57+
58+
* **languages**
59+
60+
Language codes to export. Use the language codes that your project uses. For example, use `zh-Hans` for Xcode project and `zh-rCN` for Android project even though POEditor uses `zh-CN` for simplified chinese.
61+
62+
* **language_alias** *(Optional)*
63+
64+
Specify this value to copy the translation file to another language. For example, `zh` is same with the translation of `zh-Hans` or `zh-rCN`. In this case, you can specify the `language_alias` value as follows:
65+
66+
```yaml
67+
languages: [ko, ja, zh-Hans, zh-Hant]
68+
language_alias:
69+
zh: zh-Hans
70+
```
71+
72+
* **path**
73+
74+
The path for translation files to be downloaded. Each values of `languages` will be used for filling `{LANGUAGE}` placeholder.
75+
76+
* **path_replace** *(Optional)*
77+
78+
Specify this value to enforce the translation file path. For example, Android uses `values/strings.xml` for default language and `values-ko/strings.xml` or `values-ja/strings.xml` for others. In this case, you can specify the `path_replace` as follows:
79+
80+
```yaml
81+
path: myapp/src/main/res/values-{LANGUAGE}/strings.xml
82+
path_replace:
83+
en: myapp/src/main/res/values/strings.xml
84+
```
85+
86+
* **type**
87+
88+
Translation file format. (po, pot, mo, xls, csv, resw, resx, android_strings, apple_strings, xliff, properties, key_value_json, json, xmb, xtb)
89+
90+
* **tags** *(Optional)*
91+
92+
Terms which contain whole tags will be exported. (`&&`)
93+
94+
## Example `poeditor.yml` files
95+
96+
* Xcode project
2897

2998
```yaml
30-
api_key: YOUR_API_KEY
31-
project_id: PROJECT_ID
32-
languages: [en, ko, ja, zh-Hans, zh-Hant, fr, es]
33-
path: example/Resources/{LANGUAGE}.lproj/Localizable.strings
99+
api_key: $POEDITOR_API_KEY # from envvar
100+
project_id: $POEDITOR_PROJECT_ID # from envvar
34101
type: apple_strings
35-
tags: [ios] # optional
102+
tags: [ios]
103+
104+
languages: [en, ko, ja, zh-Hans, zh-Hant]
105+
path: Resources/{LANGUAGE}.lproj/Localizable.strings
36106
```
37107

38-
| Field | Description |
39-
|---|---|
40-
| `api_key` | Your POEditor API key. You can check it on [POEditor API Access](https://poeditor.com/account/api). |
41-
| `project_id` | POEditor project ID. You can check this value on the web browser's address bar.<br />For example: `https://poeditor.com/projects/view?id=XXXXX` |
42-
| `languages` | Language codes to export. Use your project's language code.<br />For example, use `zh-Hans` if you're working on Xcode project even though POEditor uses `zh-CN` for simplified chinese. |
43-
| `path` | The path for translation files to be downloaded. Each values of `languages` will be used for filling `{LANGUAGE}` placeholder. |
44-
| `type` | Translation file format. (po, pot, mo, xls, csv, resw, resx, android_strings, apple_strings, xliff, properties, key_value_json, json, xmb, xtb) |
45-
| `tags` | (Optional) Terms which contain whole tags will be exported. (`&&`) |
108+
* Android project
109+
110+
```yaml
111+
api_key: $POEDITOR_API_KEY # from envvar
112+
project_id: $POEDITOR_PROJECT_ID # from envvar
113+
type: android_strings
114+
tags: [android]
46115
47-
2. **Export using CLI**
116+
languages: [en, ko, ja, zh-rCN, zh-rTW]
48117
49-
```console
50-
$ poeditor export
118+
path: myapp/src/main/res/values-{LANGUAGE}/strings.xml
119+
path_replace:
120+
en: myapp/src/main/res/values/strings.xml
51121
```
52122

53-
3. **You're done! 🎉**
123+
* Projects using gettext
124+
125+
```yaml
126+
api_key: $POEDITOR_API_KEY # from envvar
127+
project_id: $POEDITOR_PROJECT_ID # from envvar
128+
type: po
129+
130+
languages: [en, ko, ja, zh_Hans, zh_Hant]
131+
language_alias:
132+
zh: zh_Hans
133+
134+
path: myservice/translations/{LANGUAGE}/LC_MESSAGES/messages.po
135+
```
54136

55137
## License
56138

0 commit comments

Comments
 (0)