handlebars-i18n-cli 2.0.1 → 2.0.3

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.
Files changed (3) hide show
  1. package/README.md +10 -5
  2. package/package.json +4 -4
  3. 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
  [![Build](https://github.com/fwalzel/handlebars-i18n-cli/actions/workflows/node.js.yml/badge.svg)](https://github.com/fwalzel/handlebars-i18n-cli/actions/workflows/node.js.yml/badge.svg)
13
13
  [![Coverage Status](https://coveralls.io/repos/github/fwalzel/handlebars-i18n-cli/badge.svg?branch=main)](https://coveralls.io/github/fwalzel/handlebars-i18n-cli?branch=main)
14
14
  [![Known Vulnerabilities](https://snyk.io/test/github/fwalzel/handlebars-i18n-cli/badge.svg)](https://snyk.io/test/github/fwalzel/handlebars-i18n-cli/badge.svg)
15
+ ![npm](https://img.shields.io/npm/dt/handlebars-i18n-cli)
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
- This will generate a file `translations.json` holding the translations for `de`, `fr`, and `en` by extracting all key
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
- integration of i18next into handlebars.js, you might be able to appropriate this cli by using the option --translFunc (
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "handlebars-i18n-cli",
3
- "version": "2.0.1",
4
- "description": "Extracts translation keys from handlebars templates and forms JSON from it; generates automatic translations via DeepL.",
3
+ "version": "2.0.3",
4
+ "description": "Extract translation keys from handlebars templates and form JSON from it, generate automatic translations via DeepL",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
7
7
  "types": "types/index.d.ts",
@@ -41,10 +41,10 @@
41
41
  "homepage": "https://github.com/fwalzel/handlebars-i18n-cli#readme",
42
42
  "dependencies": {
43
43
  "async-file-tried": "^1.2.1",
44
- "axios": "^1.7.2",
44
+ "axios": "^1.8.3",
45
45
  "commander": "^12.1.0",
46
46
  "deepl-node": "^1.13.0",
47
- "dotenv": "^16.4.5",
47
+ "dotenv": "^16.4.7",
48
48
  "glob": "^11.0.0"
49
49
  },
50
50
  "devDependencies": {
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