handlebars-i18n-cli 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -5
- package/package.json +1 -1
- package/want.md +0 -18
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ for [handlebars-i18n](https://github.com/fwalzel/handlebars-i18n.git) and other
|
|
|
12
12
|
[](https://github.com/fwalzel/handlebars-i18n-cli/actions/workflows/node.js.yml/badge.svg)
|
|
13
13
|
[](https://coveralls.io/github/fwalzel/handlebars-i18n-cli?branch=main)
|
|
14
14
|
[](https://snyk.io/test/github/fwalzel/handlebars-i18n-cli/badge.svg)
|
|
15
|
+

|
|
15
16
|
|
|
16
17
|
## Install
|
|
17
18
|
|
|
@@ -32,7 +33,9 @@ If you do not link the package, you may run into the error `bash: i18n-collect:
|
|
|
32
33
|
i18n-collect <source> <target> <options...>
|
|
33
34
|
```
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
#### Example:
|
|
37
|
+
|
|
38
|
+
Generate a file `translations.json` holding the translations for `de`, `fr`, and `en` by extracting all key
|
|
36
39
|
names intended for i18next translation from all html files in your project:
|
|
37
40
|
|
|
38
41
|
```shell
|
|
@@ -126,8 +129,8 @@ generating template JSON files from them. The key names for the translations nee
|
|
|
126
129
|
template, the carry to the according language JSON is done by the CLI. You then only have to fill in according translations.
|
|
127
130
|
In case a translation string expects variables for replacement, these variables will be added to your json template.
|
|
128
131
|
|
|
129
|
-
If you are not using [handlebars-i18n](https://github.com/fwalzel/handlebars-i18n.git) for translation but a custom
|
|
130
|
-
|
|
132
|
+
If you are not using [handlebars-i18n](https://github.com/fwalzel/handlebars-i18n.git) for translation but a custom integration of i18next into handlebars.js, you
|
|
133
|
+
might be able to appropriate this cli by using the option --translFunc (
|
|
131
134
|
see below).
|
|
132
135
|
|
|
133
136
|
Also `handlebars-i18n-cli` allows you to **auto-translate** a JSON file with an existing translation to another language
|
|
@@ -359,6 +362,7 @@ FR - French
|
|
|
359
362
|
### 3. `translate`
|
|
360
363
|
|
|
361
364
|
Translates the contents of a JSON file into the specified target language and saves the output in a new JSON file.
|
|
365
|
+
Prerequisite is a (free) API Key for DeepL’s translation service. Get the key [here](https://www.deepl.com/en/pro#developer).
|
|
362
366
|
|
|
363
367
|
#### Syntax
|
|
364
368
|
|
|
@@ -368,9 +372,10 @@ i18n-deepl translate <source> <target> <targetLang> [options]
|
|
|
368
372
|
|
|
369
373
|
#### Arguments
|
|
370
374
|
|
|
371
|
-
+ `<source>`: Path to the source JSON file (e.g., ./translations.json).
|
|
375
|
+
+ `<source>`: Path to the source JSON file (e.g., ./translations.json). When target and source file are identical, the
|
|
376
|
+
result will be added (merged) to the existing file. New translations will be added, existing ones are kept.
|
|
372
377
|
+ `<target>`: Path where the translated JSON file will be saved.
|
|
373
|
-
+ `<targetLang>`: Target language code (e.g., fr for French, es for Spanish).
|
|
378
|
+
+ `<targetLang>`: Target language code (e.g., **fr** for French, **es** for Spanish).
|
|
374
379
|
|
|
375
380
|
#### Options
|
|
376
381
|
|
package/package.json
CHANGED
package/want.md
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
- isolate function from cli
|
|
2
|
-
- use commander
|
|
3
|
-
- make auto translation
|
|
4
|
-
|
|
5
|
-
API Key
|
|
6
|
-
0d520e59-eea9-24e7-908f-b2184b3039bb:fx
|
|
7
|
-
|
|
8
|
-
```shell
|
|
9
|
-
i18n-deepl setAuth 0d520e59-eea9-24e7-908f-b2184b3039bb:fx
|
|
10
|
-
```
|
|
11
|
-
```shell
|
|
12
|
-
i18n-deepl translate de.json en.json en
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
i18n-deepl translate de.json en.json en --auth-key=0d520e59-eea9-24e7-908f-b2184b3039bb:fx
|
|
17
|
-
|
|
18
|
-
i18n-deepl translate de.json de.json fr --source-sub=translations.de
|