Skip to content

Commit 26211ce

Browse files
authored
Merge pull request #62 from simplelocalize/new-commands
Add 'publish', 'status', 'pull' commands
2 parents c041887 + 26ef5d1 commit 26211ce

29 files changed

+1203
-151
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ jobs:
1515
name: "Build JAR"
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v2
19-
- uses: actions/setup-java@v1
18+
- uses: actions/checkout@v3
19+
- uses: actions/setup-java@v3
2020
with:
2121
java-version: '11'
22+
distribution: 'adopt'
2223
- name: "Cache Maven packages"
23-
uses: actions/cache@v2
24+
uses: actions/cache@v3
2425
with:
2526
path: ~/.m2
2627
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
@@ -30,7 +31,7 @@ jobs:
3031
- name: 'Get Version Number'
3132
run: echo "::set-env name=VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
3233
- name: 'Upload artifact'
33-
uses: actions/upload-artifact@v2
34+
uses: actions/upload-artifact@v3
3435
with:
3536
name: 'simplelocalize-cli-${{env.VERSION}}.jar'
3637
path: 'target/simplelocalize-cli-${{env.VERSION}}.jar'
@@ -39,7 +40,7 @@ jobs:
3940
name: "Build Windows executable"
4041
runs-on: windows-latest
4142
steps:
42-
- uses: actions/checkout@v2
43+
- uses: actions/checkout@v3
4344
- name: "Download GraalVM"
4445
run: |
4546
Invoke-RestMethod -Uri https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.1.0/graalvm-ce-java11-windows-amd64-20.1.0.zip -OutFile 'graal.zip'
@@ -57,7 +58,7 @@ jobs:
5758
echo "::set-env name=VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
5859
shell: bash
5960
- name: 'Get JAR Artifact'
60-
uses: actions/download-artifact@v2
61+
uses: actions/download-artifact@v3
6162
with:
6263
name: 'simplelocalize-cli-${{env.VERSION}}.jar'
6364
- name: "Build Native Image"
@@ -73,7 +74,7 @@ jobs:
7374
file: simplelocalize-cli-windows.exe
7475
args: --best
7576
- name: 'Upload artifact'
76-
uses: actions/upload-artifact@v2
77+
uses: actions/upload-artifact@v3
7778
with:
7879
name: simplelocalize-cli-windows
7980
path: 'simplelocalize-cli-windows.exe'
@@ -91,12 +92,12 @@ jobs:
9192
label: 'mac'
9293
runs-on: ${{ matrix.os }}
9394
steps:
94-
- uses: actions/checkout@v2
95+
- uses: actions/checkout@v3
9596
- name: 'Get Version Number'
9697
run: |
9798
echo "::set-env name=VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
9899
- name: 'Get JAR Artifact'
99-
uses: actions/download-artifact@v2
100+
uses: actions/download-artifact@v3
100101
with:
101102
name: 'simplelocalize-cli-${{env.VERSION}}.jar'
102103
- name: "Setup GraalVM"
@@ -113,7 +114,7 @@ jobs:
113114
file: simplelocalize-cli-${{ matrix.label }}
114115
args: --best
115116
- name: "Upload artifact"
116-
uses: actions/upload-artifact@v2
117+
uses: actions/upload-artifact@v3
117118
with:
118119
name: simplelocalize-cli-${{ matrix.label }}
119120
path: simplelocalize-cli-${{ matrix.label }}

.github/workflows/run-tests.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
1919
with:
2020
fetch-depth: 0
2121
- name: "Set up JDK 11"
22-
uses: actions/setup-java@v1
22+
uses: actions/setup-java@v3
2323
with:
24-
java-version: 11
24+
java-version: '11'
25+
distribution: 'adopt'
2526
- name: Cache SonarCloud packages
26-
uses: actions/cache@v1
27+
uses: actions/cache@v3
2728
with:
2829
path: ~/.sonar/cache
2930
key: ${{ runner.os }}-sonar
3031
restore-keys: ${{ runner.os }}-sonar
3132
- name: Cache Maven packages
32-
uses: actions/cache@v1
33+
uses: actions/cache@v3
3334
with:
3435
path: ~/.m2
3536
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}

README.md

Lines changed: 110 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,47 @@
66

77
## What it does?
88

9-
SimpleLocalize CLI to simplifies the process of translation in web apps, mobile apps, and games. It can:
10-
- find translation keys in your local files
11-
- upload existing translation files or translation keys
12-
- download translation file in ready to use format for already used i18n library like: i18next, Android, iOS, and many others
13-
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.
1415

1516
## Installation
1617

17-
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.
18+
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.
1819

1920
```shell
2021
# macOs / Linux / Windows (WSL)
21-
curl -s https://get.simplelocalize.io/2.0/install | bash
22+
curl -s https://get.simplelocalize.io/2.1/install | bash
2223

2324
# Windows (PowerShell)
24-
. { iwr -useb https://get.simplelocalize.io/2.0/install-windows } | iex;
25+
. { iwr -useb https://get.simplelocalize.io/2.1/install-windows } | iex;
2526
```
2627
27-
Use the same command to update SimpleLocalize CLI to the newest available version.
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+
2831
29-
You can also put the exact CLI version in URL to make sure the CLI won't change overtime, eg.: `https://get.simplelocalize.io/2.0.6/install` or `https://get.simplelocalize.io/2.0.6/install-windows`.
3032
3133
## Usage
3234
33-
SimpleLocalize CLI offers a serveral commands to invoke, `upload`, `download`, `sync` and `extract`. All of them requrires `--apiKey=KEY` parameter. You can also create a `simplelocalize.yml` file with configuration.
35+
SimpleLocalize CLI offers a several commands to invoke, All of them requires `--apiKey=KEY` parameter that is unique for each project.
3436
3537
```shell
3638
simplelocalize [command] ...parameters
3739
```
3840
41+
Commands:
42+
- `status` - gets translation project details
43+
- `upload` - uploads translation files or translation keys
44+
- `download` - downloads translation files
45+
- `sync` - uploads translation files and downloads translation files
46+
- `pull` - downloads translation files from [Translation Hosting](https://simplelocalize.io/translation-hosting)
47+
- `publish` - publishes translations to [Translation Hosting](https://simplelocalize.io/translation-hosting)
48+
- `extract` - finds and extracts translation keys in your project files
49+
3950
### Upload translations
4051
4152
Command uploads translation files from given `<UPLOAD_PATH>` to SimpleLocalize.
@@ -85,7 +96,7 @@ simplelocalize sync
8596
8697
`--downloadOptions` and `--uploadOptions` parameters are optional.
8798
88-
## Extract translation keys
99+
### Extract translation keys
89100
90101
Extract command finds and upload translation keys from project source code at `<SEARCH_DIRECTORY>` to SimpleLocalize.
91102
@@ -99,51 +110,9 @@ simplelocalize extract
99110
See [available project types](https://simplelocalize.io/docs/cli/i18n-keys-extraction/).
100111
101112
102-
## Configuration file
103-
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.
104-
105-
```properties
106-
# Load default simplelocalize.yml file
107-
simplelocalize upload
108-
109-
# Use configuration file at custom location
110-
simplelocalize -c my-configuration.yml upload
111-
```
112-
113-
### Sample configuration file
114-
115-
Filename: `simplelocalize.yml`
116-
117-
```yaml
118-
# Get started with CLI: https://simplelocalize.io/docs/cli/get-started/
119-
# Available formats: https://simplelocalize.io/docs/general/file-formats/
120-
# Available import/export options: https://simplelocalize.io/docs/general/options/
121-
113+
## Usage examples
122114
123-
# Project API Key
124-
apiKey: API_KEY
125-
126-
# Properties used by 'upload' command
127-
uploadPath: ./src/{lang}/{ns}.json
128-
uploadFormat: single-language-json
129-
uploadOptions:
130-
# by default, the 'upload' command only adds new keys and fills empty translations,
131-
# add this option to overwrite existing translations with values from the uploaded file
132-
- REPLACE_TRANSLATION_IF_FOUND
133-
134-
# Properties used by 'download' command
135-
downloadPath: ./src/{ns}/messages_{lang}.json
136-
downloadFormat: single-language-json
137-
downloadOptions:
138-
- WRITE_NESTED
139-
140-
# Properties used by 'extract' command
141-
searchDir: ./src
142-
projectType: yahoo/react-intl
143-
ignoreKeys:
144-
- 'WELCOME'
145-
- 'ABOUT-US'
146-
```
115+
Below you can find some examples of using SimpleLocalize CLI.
147116
148117
### Example: One file with translations
149118
@@ -153,7 +122,7 @@ ignoreKeys:
153122
   └── messages.json
154123
```
155124
156-
CLI command:
125+
Command:
157126
```
158127
simplelocalize upload
159128
--apiKey <PROJECT_API_KEY>
@@ -162,7 +131,7 @@ simplelocalize upload
162131
```
163132
164133
165-
### Example: Single file with multiple language directories
134+
### Example: Single file in multiple language directories
166135
167136
```bash
168137
.
@@ -174,15 +143,15 @@ simplelocalize upload
174143
└── index.json
175144
```
176145
177-
CLI command:
146+
Command:
178147
```
179148
simplelocalize upload
180149
--apiKey <PROJECT_API_KEY>
181150
--uploadPath /{lang}/index.json
182151
--uploadFormat single-language-json
183152
```
184153
185-
### Example: Multiple files with multiple language directories
154+
### Example: Multiple files in multiple language directories
186155
187156
```bash
188157
.
@@ -197,39 +166,102 @@ simplelocalize upload
197166
└── home.json
198167
```
199168
200-
CLI command:
169+
Command:
201170
```
202171
simplelocalize upload
203172
--apiKey <PROJECT_API_KEY>
204173
--uploadPath /{lang}/{ns}.json
205174
--uploadFormat single-language-json
206175
```
207176
208-
## Commands documentation
177+
### Pull resources from Translation Hosting
209178
210-
Please remember to [get API Key for your SimpleLocalize project](https://simplelocalize.io/docs/cli/get-started/) before your start.
179+
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`.
211180
212-
- `simplelocalize extract` - learn more [how to extract translation keys from local files](https://simplelocalize.io/docs/cli/i18n-keys-extraction/)
213-
- `simplelocalize upload` - learn more [how to upload translations or translation keys](https://simplelocalize.io/docs/cli/upload-translations/)
214-
- `simplelocalize download` - learn more [how to download ready to use translation file](https://simplelocalize.io/docs/cli/download-translations/)
181+
```
182+
simplelocalize pull
183+
--apiKey <PROJECT_API_KEY>
184+
--pullPath ./hosting/
185+
--environment latest
186+
```
215187
216-
## Integrations
188+
### Publish resources to Translation Hosting
217189
218-
- [Android localization guide](https://simplelocalize.io/docs/integrations/android/)
219-
- [iOS localization guide](https://simplelocalize.io/docs/integrations/ios-macos/)
220-
- [macOS localization guide](https://simplelocalize.io/docs/integrations/ios-macos/)
221-
- [JVM apps integration guide](https://simplelocalize.io/docs/file-formats/java-properties/)
222-
- [FormatJS integration guide](https://simplelocalize.io/docs/integrations/format-js/)
223-
- [FormatJS CLI messsages import guide](https://simplelocalize.io/docs/integrations/format-js-cli/)
224-
- [i18next HTTP backend integration guide](https://simplelocalize.io/docs/integrations/i18next/)
190+
It publishes translation to Translation Hosting. It behaves exactly the same as publish buttons in the SimpleLocalize (Hosting tab).
225191
226-
## Documentation
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`).
194+
195+
```
196+
simplelocalize publish
197+
--apiKey <PROJECT_API_KEY>
198+
--environment latest
199+
```
227200
228-
Head to [simplelocalize.io/docs](https://simplelocalize.io/docs/cli/get-started/) to learn the SimpleLocalize basics
201+
### Getting project details
229202
230-
## How to build project, contribute or add features?
203+
Command gets project details and prints them to the console.
204+
205+
```
206+
simplelocalize publish
207+
--apiKey <PROJECT_API_KEY>
208+
```
209+
210+
211+
## 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.
213+
214+
```properties
215+
# Load default simplelocalize.yml file
216+
simplelocalize upload
217+
218+
# Use configuration file at custom location
219+
simplelocalize -c my-configuration.yml upload
220+
```
221+
222+
### Sample configuration file
223+
224+
Filename: `simplelocalize.yml`
225+
226+
```yaml
227+
# Get started with CLI: https://simplelocalize.io/docs/cli/get-started/
228+
# Available formats: https://simplelocalize.io/docs/general/file-formats/
229+
# Available import/export options: https://simplelocalize.io/docs/general/options/
230+
231+
232+
# Project API Key
233+
apiKey: API_KEY
234+
235+
# Properties used by 'upload' command
236+
uploadPath: ./src/{lang}/{ns}.json
237+
uploadFormat: single-language-json
238+
uploadOptions:
239+
# by default, the 'upload' command only adds new keys and fills empty translations,
240+
# add this option to overwrite existing translations with values from the uploaded file
241+
- REPLACE_TRANSLATION_IF_FOUND
242+
243+
# Properties used by 'download' command
244+
downloadPath: ./src/{ns}/messages_{lang}.json
245+
downloadFormat: single-language-json
246+
downloadOptions:
247+
- WRITE_NESTED
248+
249+
# Properties used by 'extract' command
250+
searchDir: ./src
251+
projectType: yahoo/react-intl
252+
ignoreKeys:
253+
- 'WELCOME'
254+
- 'ABOUT-US'
255+
256+
# Properties used by 'pull' and 'publish' command
257+
pullPath: ./src/hosting/
258+
environment: 'production' # or 'latest'
259+
260+
```
261+
262+
## Documentation
231263
232-
[Please see CONTRIBUTING.md file](https://github.com/simplelocalize/simplelocalize-cli/blob/bd71926809085048bbe76ec1fea205c70f885acb/CONTRIBUTING.md)
264+
Visit [simplelocalize.io/docs/cli/get-started/](https://simplelocalize.io/docs/cli/get-started/) to get more information about SimpleLocalize CLI.
233265
234266
## License
235267

pom.xml

Lines changed: 1 addition & 1 deletion
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.0.6</version>
7+
<version>2.1.0</version>
88
<packaging>jar</packaging>
99
<name>simplelocalize-cli</name>
1010
<description>Official SimpleLocalize Command Line Interface</description>

0 commit comments

Comments
 (0)