Skip to content

Commit bf028eb

Browse files
authored
Merge pull request #113 from simplelocalize/version-2.7
Version 2.7
2 parents 7856718 + 0f68e26 commit bf028eb

38 files changed

+637
-1178
lines changed

README.md

Lines changed: 68 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ The installation process is automated by command-line scripts. Both scripts for
3030

3131
```shell
3232
# macOs / Linux / Windows (WSL)
33-
curl -s https://get.simplelocalize.io/2.6/install | bash
33+
curl -s https://get.simplelocalize.io/2.7/install | bash
3434

3535
# Windows (PowerShell)
36-
. { iwr -useb https://get.simplelocalize.io/2.6/install-windows } | iex;
36+
. { iwr -useb https://get.simplelocalize.io/2.7/install-windows } | iex;
3737
```
3838
3939
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
4444
4545
## Usage
4646
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`.
4949
5050
```shell
5151
simplelocalize [command] ...parameters
@@ -56,17 +56,12 @@ Available commands:
5656
- `status` - gets translation project details
5757
- `upload` - uploads translation files or translation keys
5858
- `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
6463
- `extract` - finds and extracts translation keys in your project files
6564
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-
7065
## Create configuration file
7166
7267
Command creates a sample configuration file in the current directory.
@@ -79,7 +74,9 @@ simplelocalize init
7974
8075
## Upload translations
8176
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`.
8380
8481
```shell
8582
simplelocalize upload
@@ -88,9 +85,6 @@ simplelocalize upload
8885
--uploadFormat <UPLOAD_FORMAT>
8986
```
9087
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-
9488
Upload format is a format of the file(s) with translations. [See available upload formats](https://simplelocalize.io/docs/general/file-formats/)
9589
9690
**Additional parameters:**
@@ -101,7 +95,7 @@ E.g.: `--uploadOptions TRIM_LEADING_TRAILING_SPACES`. To pass multiple options,
10195
10296
Learn more about [upload translations command](https://simplelocalize.io/docs/cli/upload-translations/).
10397
104-
### Example: One file with translations
98+
### Example: One file with multiple languages
10599
106100
```bash
107101
.
@@ -113,12 +107,38 @@ Command:
113107
```
114108
simplelocalize upload
115109
--apiKey <PROJECT_API_KEY>
116-
--uploadPath /locales/messages.json
110+
--uploadPath ./locales/messages.json
117111
--uploadFormat multi-language-json
118112
```
119113
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+
```
120137
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.
122142
123143
```bash
124144
.
@@ -138,17 +158,19 @@ simplelocalize upload
138158
--uploadFormat single-language-json
139159
```
140160
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.
142164
143165
```bash
144166
.
145-
├── ca
167+
├── italian
146168
│   ├── common.json
147169
│   └── home.json
148-
├── en
170+
├── english
149171
│   ├── common.json
150172
│   └── home.json
151-
└── es
173+
└── spanish
152174
├── common.json
153175
└── home.json
154176
```
@@ -157,15 +179,15 @@ Command:
157179
```
158180
simplelocalize upload
159181
--apiKey <PROJECT_API_KEY>
160-
--uploadPath /{lang}/{ns}.json
182+
--uploadPath /english/{ns}.json
183+
--uploadLanguageKey en-GB
161184
--uploadFormat single-language-json
162185
```
163186
164187
165188
## Download translations
166189
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.
169191
170192
```shell
171193
simplelocalize download
@@ -174,20 +196,30 @@ simplelocalize download
174196
--downloadFormat <DOWNLOAD_FORMAT>
175197
```
176198
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
179202
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+
```
181212
182213
**Additional parameters:**
214+
- `--downloadLanguageKey` allows you to download translation for specified languages. Eg.: `--downloadLanguageKey en,de,fr`.
183215
- `--downloadOptions` allows you to pass [additional options](https://simplelocalize.io/docs/general/options/) to the download command. Eg.: `--downloadOptions WRITE_NESTED`.
184216
- `--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`.
185217
186218
Learn more about [download translations command](https://simplelocalize.io/docs/cli/download-translations/).
187219
188220
## Auto-translate strings
189221
190-
Auto-translate command starts [auto-translation](https://simplelocalize.io/auto-translation) jobs for all languages in the project or for languages specified in `--languageKeys` parameter.
222+
Auto-translate command starts auto-translation tasks for all languages in the project or for languages specified in `--languageKeys` parameter.
191223
Auto-translation configuration is taken from the last auto-translation job in the project for the given language.
192224
193225
```properties
@@ -237,24 +269,6 @@ Command gets project details and prints them to the console.
237269
simplelocalize status --apiKey <PROJECT_API_KEY>
238270
```
239271
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-
258272
## Purge translations
259273
260274
Command removes all translations, translation keys and languages from [Translation Editor](https://simplelocalize.io/translation-editor).
@@ -307,15 +321,17 @@ Filename: `simplelocalize.yml`
307321
apiKey: API_KEY
308322
309323
# Properties used by 'upload' command
310-
uploadPath: ./src/{lang}/{ns}.json
324+
uploadPath: ./source-translations/messages_en.json
325+
uploadLanguageKey: en-GB
311326
uploadFormat: single-language-json
312327
uploadOptions:
313328
# by default, the 'upload' command only adds new keys and fills empty translations,
314329
# add this option to overwrite existing translations with values from the uploaded file
315330
- REPLACE_TRANSLATION_IF_FOUND
316331
317332
# Properties used by 'download' command
318-
downloadPath: ./src/{ns}/messages_{lang}.json
333+
downloadPath: ./output-translations/messages_{lang}.json
334+
downloadLanguageKey: ['de-DE', 'fr-FR', 'pl-PL']
319335
downloadFormat: single-language-json
320336
downloadOptions:
321337
- WRITE_NESTED
@@ -329,8 +345,7 @@ ignoreKeys:
329345
330346
# Properties used by 'pull' and 'publish' command
331347
pullPath: ./src/hosting/
332-
environment: '_production' # or '_latest', or 'my_custom'
333-
348+
environment: '_production' # or '_latest', or 'my_custom'
334349
```
335350
336351
## Proxy support
@@ -358,4 +373,3 @@ Please refer to the [official SimpleLocalize documentation](https://simplelocali
358373
## License
359374
360375
See [LICENSE](/LICENSE) for more details.
361-

junit/mock-server/test.json

Lines changed: 21 additions & 2 deletions
Large diffs are not rendered by default.

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>io.simplelocalize</groupId>
66
<artifactId>simplelocalize-cli</artifactId>
7-
<version>2.6.0</version>
7+
<version>2.7.0</version>
88
<packaging>jar</packaging>
99
<name>simplelocalize-cli</name>
1010
<description>Official SimpleLocalize Command Line Interface</description>
@@ -17,7 +17,7 @@
1717

1818
<!-- versions -->
1919
<junit5.version>5.9.2</junit5.version>
20-
<picocli.version>4.7.5</picocli.version>
20+
<picocli.version>4.7.6</picocli.version>
2121
<jackson.version>2.14.2</jackson.version>
2222
<lombok.version>1.18.30</lombok.version>
2323

reflect-config.json

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@
1010
{ "name" : "debug" }
1111
],
1212
"methods" : [
13-
{ "name" : "download", "parameterTypes" : ["java.lang.String", "java.lang.String", "java.lang.String", "java.util.List", "java.lang.String","java.lang.String", "java.lang.String", "java.lang.String"] },
13+
{ "name" : "download", "parameterTypes" : [
14+
"java.lang.String",
15+
"java.lang.String",
16+
"java.lang.String",
17+
"java.util.List",
18+
"java.lang.String",
19+
"java.lang.String",
20+
"java.lang.String",
21+
"java.lang.String",
22+
"java.lang.String"
23+
] },
1424
{
1525
"name": "extract",
1626
"parameterTypes": [
@@ -31,18 +41,22 @@
3141
]
3242
},
3343
{ "name" : "status", "parameterTypes" : ["java.lang.String", "java.lang.String"] },
34-
{ "name" : "sync", "parameterTypes" : ["java.lang.String", "java.lang.String", "java.lang.String", "java.util.List", "java.lang.String", "java.lang.String", "java.util.List", "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String"] },
35-
{ "name" : "upload", "parameterTypes" : ["java.lang.String", "java.lang.String", "java.lang.String", "java.lang.Boolean", "java.lang.Boolean", "java.lang.Boolean", "java.util.List", "java.lang.String", "java.lang.String", "java.lang.String"] },
44+
{ "name" : "upload", "parameterTypes" : [
45+
"java.lang.String",
46+
"java.lang.String",
47+
"java.lang.String",
48+
"java.util.List",
49+
"java.lang.String",
50+
"java.lang.String",
51+
"java.lang.String",
52+
"java.lang.Boolean",
53+
"java.lang.Boolean",
54+
"java.lang.Boolean",
55+
"java.lang.String"
56+
] },
3657
{ "name" : "purge", "parameterTypes" : ["java.lang.String", "java.lang.String", "java.lang.Boolean"] }
3758
]
3859
},
39-
{
40-
"name" : "io.simplelocalize.cli.client.dto.proxy.AutoTranslationConfiguration",
41-
"allDeclaredConstructors" : true,
42-
"allPublicConstructors" : true,
43-
"allDeclaredMethods" : true,
44-
"allPublicMethods" : true
45-
},
4660
{
4761
"name": "io.simplelocalize.cli.client.dto.proxy.SimpleLocalizeJsonMetadata",
4862
"allDeclaredConstructors": true,

0 commit comments

Comments
 (0)