Skip to content

Commit 0f6ea0c

Browse files
authored
Merge pull request #73 from simplelocalize/cli-2.2
New commands and switches
2 parents 74d4811 + 4eb984c commit 0f6ea0c

34 files changed

+699
-137
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ jobs:
6868
run: |
6969
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
7070
./graalvm-ce-java11-20.1.0/bin/native-image --no-server -Dmicronaut.env.deduction=false --report-unsupported-elements-at-runtime -cp simplelocalize-cli-${{env.VERSION}}.jar -H:Name="simplelocalize-cli-windows" io.simplelocalize.cli.SimplelocalizeCliCommand
71-
- name: "Optimize executable"
72-
uses: svenstaro/upx-action@v2
73-
with:
74-
file: simplelocalize-cli-windows.exe
75-
args: --best
71+
# - name: "Optimize executable"
72+
# uses: svenstaro/upx-action@v2
73+
# with:
74+
# file: simplelocalize-cli-windows.exe
75+
# args: --best
7676
- name: 'Upload artifact'
7777
uses: actions/upload-artifact@v3
7878
with:
@@ -108,12 +108,12 @@ jobs:
108108
run: gu install native-image
109109
- name: "Build Native Image"
110110
run: native-image --no-server -Dmicronaut.env.deduction=false --report-unsupported-elements-at-runtime -cp simplelocalize-cli-*.jar -H:Name="simplelocalize-cli-${{matrix.label}}" io.simplelocalize.cli.SimplelocalizeCliCommand
111-
- name: "Optimize executable"
112-
if: matrix.label != 'mac'
113-
uses: svenstaro/upx-action@v2
114-
with:
115-
file: simplelocalize-cli-${{ matrix.label }}
116-
args: --best
111+
# - name: "Optimize executable"
112+
# if: matrix.label != 'mac'
113+
# uses: svenstaro/upx-action@v2
114+
# with:
115+
# file: simplelocalize-cli-${{ matrix.label }}
116+
# args: --best
117117
- name: "Upload artifact"
118118
uses: actions/upload-artifact@v3
119119
with:

README.md

Lines changed: 90 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,80 +6,114 @@
66

77
## What it does?
88

9-
SimpleLocalize CLI offers:
10-
- finding and extracting translation keys in your project files
11-
- uploading translation files or translation keys
12-
- downloading translation files
13-
- getting translation project status
14-
- publishing translations to the CDN.
9+
SimpleLocalize command-line tool allows you to:
10+
- upload and download translations,
11+
- [auto-translate](https://simplelocalize.io/auto-translate) translations,
12+
- publish and push [Translation Hosting](https://simplelocalize.io/translation-hosting) translations,
13+
- extract translation keys from your project files,
14+
- and more...
15+
16+
It is a great tool for CI/CD pipelines and localization automation.
1517

1618
## Installation
1719

1820
The installation process is automated by command-line scripts. Both scripts for Windows (PowerShell) and macOS/Linux/Windows downloads a binary file with CLI, copies it to user files and makes it available to run anywhere in the system from a command-line.
1921

2022
```shell
2123
# macOs / Linux / Windows (WSL)
22-
curl -s https://get.simplelocalize.io/2.1/install | bash
24+
curl -s https://get.simplelocalize.io/2.2/install | bash
2325

2426
# Windows (PowerShell)
25-
. { iwr -useb https://get.simplelocalize.io/2.1/install-windows } | iex;
27+
. { iwr -useb https://get.simplelocalize.io/2.2/install-windows } | iex;
2628
```
2729
28-
To change or update the CLI version, run the installation script with the desired version number in the URL. You can also put the exact CLI version in URL to
29-
explicitly point the version you want to use, e.g.: `https://get.simplelocalize.io/2.0.6/install` or `https://get.simplelocalize.io/2.0.6/install-windows`. See [releases](https://github.com/simplelocalize/simplelocalize-cli/releases) for the list of available versions.
30-
30+
To change or update the CLI version, run the installation script with the desired version number in the URL, e.g.:
31+
- `https://get.simplelocalize.io/2.0.6/install` installs version 2.0.6 on macOS/Linux/Windows (WSL)
32+
- `https://get.simplelocalize.io/2.0.6/install-windows` installs version 2.0.6 on Windows (PowerShell)
3133
34+
See [releases](https://github.com/simplelocalize/simplelocalize-cli/releases) for the list of available versions.
3235
3336
## Usage
3437
35-
SimpleLocalize CLI offers a several commands to invoke, All of them requires `--apiKey=KEY` parameter that is unique for each project.
38+
The command-line tool offers several commands to execute.
39+
All of them requires `--apiKey YOUR_API_KEY` parameter that is unique for each project.
3640
3741
```shell
3842
simplelocalize [command] ...parameters
3943
```
4044
41-
Commands:
45+
Available commands:
46+
- `init` - creates a sample configuration file
4247
- `status` - gets translation project details
4348
- `upload` - uploads translation files or translation keys
4449
- `download` - downloads translation files
4550
- `sync` - uploads translation files and downloads translation files
51+
- `auto-translate` - starts [auto-translation](https://simplelocalize.io/auto-translation) jobs
4652
- `pull` - downloads translation files from [Translation Hosting](https://simplelocalize.io/translation-hosting)
4753
- `publish` - publishes translations to [Translation Hosting](https://simplelocalize.io/translation-hosting)
4854
- `extract` - finds and extracts translation keys in your project files
4955
50-
### Upload translations
5156
52-
Command uploads translation files from given `<UPLOAD_PATH>` to SimpleLocalize.
57+
Use `--help` parameter to get more information about the command and its parameters
58+
or [check documentation](https://simplelocalize.io/docs/cli/get-started/).
59+
60+
## Create configuration file
61+
62+
Command creates a sample configuration file in the current directory.
63+
The configuration file simplifies the usage of the command-line tool
64+
by providing a default configuration for the project and allowing to omit some parameters.
65+
66+
```shell
67+
simplelocalize init
68+
```
69+
70+
## Upload translations
71+
72+
Command uploads translation files from given `<UPLOAD_PATH_PATTERN>` to [Translation Editor](https://simplelocalize.io/translation-editor/), e.g.: `./src/translations/messages.json`.
5373
5474
```shell
5575
simplelocalize upload
5676
--apiKey <PROJECT_API_KEY>
57-
--uploadPath <UPLOAD_PATH>
77+
--uploadPath <UPLOAD_PATH_PATTERN>
5878
--uploadFormat <UPLOAD_FORMAT>
59-
--uploadOptions <UPLOAD_OPTIONS>
6079
```
6180
62-
`--uploadOptions` parameter is optional. Use `REPLACE_TRANSLATION_IF_FOUND` option to update existing translations.
81+
You can use `{lang}` placeholder to specify language or locale and `{ns}` placeholder to specify namespace,
82+
e.g.: `./src/translations/{lang}/{ns}.json`.
83+
84+
Upload format is a format of the file(s) with translations. [See available upload formats](https://simplelocalize.io/docs/general/file-formats/)
85+
86+
#### Additional parameters:
87+
- `--replace` allows you to **replace** existing translations with new ones.
88+
- `--delete` allows you to **delete** translations that are not present in uploaded files.
89+
- `--dryRun` allows you to **check** what translation files will be uploaded without actually uploading them.
90+
- `--uploadOptions` allows you to pass [additional options](https://simplelocalize.io/docs/general/options/) to the upload command.
91+
Eg.: `--uploadOptions TRIM_LEADING_TRAILING_SPACES`. To pass multiple options, use comma as a separator.
6392
6493
Learn more about [upload translations command](https://simplelocalize.io/docs/cli/upload-translations/).
6594
66-
### Download translations
95+
## Download translations
6796
68-
Command downloads translation files from SimpleLocalize to given `<DOWNLOAD_PATH>`.
97+
Command downloads translation files from [Translation Editor](https://simplelocalize.io/translation-editor/) to given `<DOWNLOAD_PATH_PATTERN>`, e.g.: `./src/translations/messages.json`.
6998
7099
```shell
71100
simplelocalize download
72101
--apiKey <PROJECT_API_KEY>
73-
--downloadPath <DOWNLOAD_PATH>
102+
--downloadPath <DOWNLOAD_PATH_PATTERN>
74103
--downloadFormat <DOWNLOAD_FORMAT>
75-
--downloadOptions <DOWNLOAD_OPTIONS>
76104
```
77105
78-
`--downloadOptions` parameter is optional.
106+
You can use `{lang}` placeholder to specify language or locale and `{ns}` placeholder to specify namespace,
107+
e.g.: `./src/translations/{lang}/{ns}.json`.
108+
109+
Download format is a format of the file(s) with translations. [See available download formats](https://simplelocalize.io/docs/general/file-formats/)
110+
111+
#### Additional parameters:
112+
- `--downloadOptions` allows you to pass [additional options](https://simplelocalize.io/docs/general/options/) to the download command. Eg.: `--downloadOptions WRITE_NESTED`.
79113
80114
Learn more about [download translations command](https://simplelocalize.io/docs/cli/download-translations/).
81115
82-
### Sync translations
116+
## Sync translations
83117
84118
Sync command combines upload and download command executions.
85119
@@ -96,7 +130,19 @@ simplelocalize sync
96130
97131
`--downloadOptions` and `--uploadOptions` parameters are optional.
98132
99-
### Extract translation keys
133+
## Auto-translate translations
134+
135+
Auto-translate command starts [auto-translation](https://simplelocalize.io/auto-translation) jobs.
136+
137+
```properties
138+
simplelocalize auto-translate
139+
--apiKey <PROJECT_API_KEY>
140+
```
141+
142+
Additional parameters:
143+
- `--languageKeys` allows you to specify languages to auto-translate. Eg.: `--languageKeys en,de,fr`.
144+
145+
## Extract translation keys
100146
101147
Extract command finds and upload translation keys from project source code at `<SEARCH_DIRECTORY>` to SimpleLocalize.
102148
@@ -112,7 +158,7 @@ See [available project types](https://simplelocalize.io/docs/cli/i18n-keys-extra
112158
113159
## Usage examples
114160
115-
Below you can find some examples of using SimpleLocalize CLI.
161+
Below, you can find some examples of using SimpleLocalize CLI.
116162
117163
### Example: One file with translations
118164
@@ -174,7 +220,7 @@ simplelocalize upload
174220
--uploadFormat single-language-json
175221
```
176222
177-
### Pull resources from Translation Hosting
223+
## Pull resources from Translation Hosting
178224
179225
Downloads all translation hosting files to given directory in `--pullPath` parameter. It overwrites existing files and creates subdirectories if necessary. Available environment variables: `latest`, `production`.
180226
@@ -185,20 +231,27 @@ simplelocalize pull
185231
--environment latest
186232
```
187233
188-
### Publish resources to Translation Hosting
234+
Additional parameters:
235+
`--filterRegex` allows you to filter files by regex, e.g.: `--filterRegex '__index.json'` will download only `__index.json` file.
189236
190-
It publishes translation to Translation Hosting. It behaves exactly the same as publish buttons in the SimpleLocalize (Hosting tab).
237+
## Publish resources to Translation Hosting
191238
192-
- `--environment latest` gets translations from Translation Editor and publishes them to Translation Hosting to `latest` environment.
193-
- `--environment production` gets translations from Translation Hosting (`latest`) and publishes them to Translation Hosting (`production`).
239+
It publishes translation to [Translation Hosting](https://simplelocalize.io/translation-hosting). It behaves exactly the same as publish buttons in the SimpleLocalize (Hosting tab).
194240
195241
```
196242
simplelocalize publish
197243
--apiKey <PROJECT_API_KEY>
198244
--environment latest
199245
```
200246
201-
### Getting project details
247+
- `--environment latest` gets translations from Translation Editor and publishes them to Translation Hosting to `latest` environment.
248+
- `--environment production` gets translations from Translation Hosting (`latest`) and publishes them to Translation Hosting (`production`).
249+
250+
```
251+
(Translation Editor) --> ('latest' environment) --> ('production' environment)
252+
```
253+
254+
## Getting project details
202255
203256
Command gets project details and prints them to the console.
204257
@@ -209,7 +262,10 @@ simplelocalize status
209262
210263
211264
## Configuration file
212-
Use configuration file in order to simplify your bash command. Arguments used in command always overrides properties set in configuration file. By default, SimpleLocalize will load configuration from file named `simplelocalize.yml`. You can load configuration from different location by using a `-c` parameters.
265+
Use configuration file in order to simplify your bash command.
266+
Arguments used in command always override properties set in the configuration file.
267+
By default, SimpleLocalize will load configuration from file named `simplelocalize.yml`.
268+
You can load configuration from different location by using a `-c` parameters.
213269
214270
```properties
215271
# Load default simplelocalize.yml file
@@ -219,7 +275,7 @@ simplelocalize upload
219275
simplelocalize -c my-configuration.yml upload
220276
```
221277
222-
### Sample configuration file
278+
## Sample configuration file
223279
224280
Filename: `simplelocalize.yml`
225281

junit/extreme-edge-cases/meaningless-directory/email_messages_de-DE.properties

Whitespace-only changes.

junit/extreme-edge-cases/meaningless-directory/email_messages_en%US.properties

Whitespace-only changes.

junit/extreme-edge-cases/meaningless-directory/email_messages_es-ES.properties

Whitespace-only changes.

junit/extreme-edge-cases/meaningless-directory/home-en_GB.properties

Whitespace-only changes.

junit/extreme-edge-cases/meaningless-directory/home_en-GB.properties

Whitespace-only changes.

junit/extreme-edge-cases/meaningless-directory/home_pl-PL.properties

Whitespace-only changes.

junit/lang-as-directories-ns-as-filename/meaningless-directory/en/common.json

Whitespace-only changes.

junit/lang-as-directories-ns-as-filename/meaningless-directory/en/home.json

Whitespace-only changes.

0 commit comments

Comments
 (0)