You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To change or update the CLI version, run the installation script with the desired version number in the URL, e.g.:
@@ -44,8 +44,8 @@ See [releases](https://github.com/simplelocalize/simplelocalize-cli/releases) fo
44
44
45
45
## Usage
46
46
47
-
The command-line tool offers several commands to execute.
48
-
All of them requires `--apiKey YOUR_API_KEY` parameter that is unique for each project.
47
+
The command-line tool offers several commands to execute. All of them requires Project API Key that is unique for each project.
48
+
You can set`apiKey`in simplelocalize.yml configuration file, pass it as parameter with `--apiKey` or set it by environment variable `SIMPLELOCALIZE_API_KEY`.
49
49
50
50
```shell
51
51
simplelocalize [command] ...parameters
@@ -56,17 +56,12 @@ Available commands:
56
56
- `status` - gets translation project details
57
57
- `upload` - uploads translation files or translation keys
58
58
- `download` - downloads translation files
59
-
- `sync` - uploads translation files and downloads translation files
60
-
- `auto-translate` - starts [auto-translation](https://simplelocalize.io/auto-translation) jobs
61
-
- `pull` - downloads translation files from [Translation Hosting](https://simplelocalize.io/translation-hosting)
62
-
- `publish` - publishes translations to [Translation Hosting](https://simplelocalize.io/translation-hosting)
63
-
- `purge` - removes all translation, translation keys and languages from [Translation Editor](https://simplelocalize.io/translation-editor)
59
+
- `auto-translate` - starts [auto-translation](https://simplelocalize.io/auto-translation/) jobs
60
+
- `pull` - downloads translation files from [Translation Hosting](https://simplelocalize.io/translation-hosting/)
61
+
- `publish` - publishes translations to [Translation Hosting](https://simplelocalize.io/translation-hosting/)
62
+
- `purge` - removes all translation, translation keys and languages from the project
64
63
- `extract` - finds and extracts translation keys in your project files
65
64
66
-
67
-
Use `--help` parameter to get more information about the command and its parameters
68
-
or [check documentation](https://simplelocalize.io/docs/cli/get-started/).
69
-
70
65
## Create configuration file
71
66
72
67
Command creates a sample configuration file in the current directory.
@@ -79,7 +74,9 @@ simplelocalize init
79
74
80
75
## Upload translations
81
76
82
-
Command uploads translation files from given `<UPLOAD_PATH_PATTERN>` to [Translation Editor](https://simplelocalize.io/translation-editor/), e.g.: `./src/translations/messages.json`.
77
+
Upload command takes your local files and uploads them to SimpleLocalize. You can specify a path to the file or use placeholders to upload many files at once.
78
+
A good practise is to **upload only source translations** instead of uploading all translations on each run. You can use `{lang}` placeholder to specify language or locale and `{ns}` placeholder to specify namespace,
79
+
e.g.: `./src/translations/{lang}/{ns}.json`.
83
80
84
81
```shell
85
82
simplelocalize upload
@@ -88,9 +85,6 @@ simplelocalize upload
88
85
--uploadFormat <UPLOAD_FORMAT>
89
86
```
90
87
91
-
You can use `{lang}` placeholder to specify language or locale and `{ns}` placeholder to specify namespace,
92
-
e.g.: `./src/translations/{lang}/{ns}.json`.
93
-
94
88
Upload format is a format of the file(s) with translations. [See available upload formats](https://simplelocalize.io/docs/general/file-formats/)
Learn more about [upload translations command](https://simplelocalize.io/docs/cli/upload-translations/).
103
97
104
-
### Example: One file with translations
98
+
### Example: One file with multiple languages
105
99
106
100
```bash
107
101
.
@@ -113,12 +107,38 @@ Command:
113
107
```
114
108
simplelocalize upload
115
109
--apiKey <PROJECT_API_KEY>
116
-
--uploadPath /locales/messages.json
110
+
--uploadPath ./locales/messages.json
117
111
--uploadFormat multi-language-json
118
112
```
119
113
114
+
### Example: One file per language
115
+
116
+
In this example we upload only source translations from `./en/messages.json` and uses `--uploadLanguageKey en-GB` to specify language key for the uploaded file for the Translation Editor.
117
+
It's a recommended way to upload source translations.
118
+
119
+
```bash
120
+
.
121
+
├── ca
122
+
│ └── messages.json
123
+
├── en
124
+
│ └── messages.json
125
+
└── es
126
+
└── messages.json
127
+
```
128
+
129
+
Command:
130
+
```
131
+
simplelocalize upload
132
+
--apiKey <PROJECT_API_KEY>
133
+
--uploadPath ./en/index.json
134
+
--uploadLanguageKey en-GB
135
+
--uploadFormat single-language-json
136
+
```
120
137
121
-
### Example: Single file in multiple language directories
138
+
### Example: One file per language using placeholders
139
+
140
+
In this example we use `{lang}` placeholder to upload **many files** at once and specify language key for each file.
141
+
It's not a recommended way to upload source translations, as it uploads more files than necessary.
122
142
123
143
```bash
124
144
.
@@ -138,17 +158,19 @@ simplelocalize upload
138
158
--uploadFormat single-language-json
139
159
```
140
160
141
-
### Example: Multiple files in multiple language directories
161
+
### Example: One file per language and namespace
162
+
163
+
In this example we use `{ns}` placeholder to upload **many files** at once for the English language. We used `--uploadLanguageKey en-GB` to specify language key for the uploaded file for the Translation Editor.
142
164
143
165
```bash
144
166
.
145
-
├── ca
167
+
├── italian
146
168
│ ├── common.json
147
169
│ └── home.json
148
-
├── en
170
+
├── english
149
171
│ ├── common.json
150
172
│ └── home.json
151
-
└── es
173
+
└── spanish
152
174
├── common.json
153
175
└── home.json
154
176
```
@@ -157,15 +179,15 @@ Command:
157
179
```
158
180
simplelocalize upload
159
181
--apiKey <PROJECT_API_KEY>
160
-
--uploadPath /{lang}/{ns}.json
182
+
--uploadPath /english/{ns}.json
183
+
--uploadLanguageKey en-GB
161
184
--uploadFormat single-language-json
162
185
```
163
186
164
187
165
188
## Download translations
166
189
167
-
Command downloads translation files from the [Translation Editor](https://simplelocalize.io/translation-editor/) to the given `<DOWNLOAD_PATH_PATTERN>`,
168
-
e.g.: `./src/translations/messages.json`.
190
+
Download works similarly to the upload command, but this time it exports translation files from the Translation Editor to your local files.
169
191
170
192
```shell
171
193
simplelocalize download
@@ -174,20 +196,30 @@ simplelocalize download
174
196
--downloadFormat <DOWNLOAD_FORMAT>
175
197
```
176
198
177
-
You can use `{lang}` placeholder to specify language or locale and `{ns}` placeholder to specify namespace,
178
-
e.g.: `./src/translations/{lang}/{ns}.json`.
199
+
Download format is a format of the file(s) with translations. [See available upload formats](https://simplelocalize.io/docs/general/file-formats/)
200
+
201
+
### Example
179
202
180
-
Download format is a format of the file(s) with translations. [See available download formats](https://simplelocalize.io/docs/general/file-formats/)
203
+
Same as before you can use `{lang}` and `{ns}` placeholders to download many files at once and specify language keys that should be downloaded, eg.:
204
+
205
+
```shell
206
+
simplelocalize download
207
+
--apiKey <PROJECT_API_KEY>
208
+
--downloadPath ./src/{ns}/messages_{lang}.json
209
+
--downloadFormat single-language-json
210
+
--downloadLanguageKey en,de,fr
211
+
```
181
212
182
213
**Additional parameters:**
214
+
- `--downloadLanguageKey` allows you to download translation for specified languages. Eg.: `--downloadLanguageKey en,de,fr`.
183
215
- `--downloadOptions` allows you to pass [additional options](https://simplelocalize.io/docs/general/options/) to the download command. Eg.: `--downloadOptions WRITE_NESTED`.
184
216
- `--downloadSort` allows you to sort translations in the downloaded file. Eg.: `--downloadSort NEWEST_KEYS_FIRST`. Available options: `NEWEST_KEYS_FIRST`, `NEWEST_KEYS_LAST`, `NAMESPACES`, `IMPORT_ORDER`.
185
217
186
218
Learn more about [download translations command](https://simplelocalize.io/docs/cli/download-translations/).
187
219
188
220
## Auto-translate strings
189
221
190
-
Auto-translate command starts [auto-translation](https://simplelocalize.io/auto-translation) jobsforall languagesin the project or forlanguages specifiedin`--languageKeys` parameter.
222
+
Auto-translate command starts auto-translation tasksforall languagesin the project or forlanguages specifiedin`--languageKeys` parameter.
191
223
Auto-translation configuration is taken from the last auto-translation job in the project for the given language.
192
224
193
225
```properties
@@ -237,24 +269,6 @@ Command gets project details and prints them to the console.
237
269
simplelocalize status --apiKey <PROJECT_API_KEY>
238
270
```
239
271
240
-
## Sync translations
241
-
242
-
Sync command combines upload and download command executions.
243
-
244
-
```properties
245
-
simplelocalize sync
246
-
--apiKey <PROJECT_API_KEY>
247
-
--downloadPath <DOWNLOAD_PATH>
248
-
--downloadFormat <DOWNLOAD_FORMAT>
249
-
--downloadOptions <DOWNLOAD_OPTIONS>
250
-
--uploadPath <UPLOAD_PATH>
251
-
--uploadFormat <UPLOAD_FORMAT>
252
-
--uploadOptions <UPLOAD_OPTIONS>
253
-
```
254
-
255
-
`--downloadOptions` and `--uploadOptions` parameters are optional.
256
-
257
-
258
272
## Purge translations
259
273
260
274
Command removes all translations, translation keys and languages from [Translation Editor](https://simplelocalize.io/translation-editor).
0 commit comments