@vocab/cli 1.3.6 → 1.4.0
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 +32 -0
- package/dist/vocab-cli.cjs.dev.js +6 -1
- package/dist/vocab-cli.cjs.prod.js +6 -1
- package/dist/vocab-cli.esm.js +6 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -506,6 +506,38 @@ Tags on keys in other languages will be ignored.
|
|
|
506
506
|
[tags]: https://support.phrase.com/hc/en-us/articles/5822598372252-Tags-Strings-
|
|
507
507
|
[configuration]: #Configuration
|
|
508
508
|
|
|
509
|
+
#### Global key
|
|
510
|
+
|
|
511
|
+
`vocab push` and `vocab pull` can support global keys mapping. When you want certain translations to use a specific/custom key in Phrase, add the `globalKey` to the structure.
|
|
512
|
+
|
|
513
|
+
```jsonc
|
|
514
|
+
// translations.json
|
|
515
|
+
{
|
|
516
|
+
"Hello": {
|
|
517
|
+
"message": "Hello",
|
|
518
|
+
"globalKey": "hello"
|
|
519
|
+
},
|
|
520
|
+
"Goodbye": {
|
|
521
|
+
"message": "Goodbye",
|
|
522
|
+
"globalKey": "app.goodbye.label"
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
In the above example,
|
|
528
|
+
|
|
529
|
+
- `vocab push` will push the `hello` and `app.goodbye.label` keys to Phrase.
|
|
530
|
+
- `vocab pull` will pull translations from Phrase and map them to the `hello` and `app.goodbye.label` keys.
|
|
531
|
+
|
|
532
|
+
##### Error on no translation for global key
|
|
533
|
+
|
|
534
|
+
By default, `vocab pull` will not error if a translation is missing in Phrase for a translation with a global key.
|
|
535
|
+
If you want to throw an error in this situation, pass the `--error-on-no-global-key-translation` flag:
|
|
536
|
+
|
|
537
|
+
```sh
|
|
538
|
+
vocab pull --error-on-no-global-key-translation
|
|
539
|
+
```
|
|
540
|
+
|
|
509
541
|
## Troubleshooting
|
|
510
542
|
|
|
511
543
|
### Problem: Passed locale is being ignored or using en-US instead
|
|
@@ -46,7 +46,12 @@ yargs__default["default"](process.argv.slice(2)).scriptName('vocab').option('con
|
|
|
46
46
|
}).command({
|
|
47
47
|
command: 'pull',
|
|
48
48
|
builder: () => yargs__default["default"].options({
|
|
49
|
-
branch: branchDefinition
|
|
49
|
+
branch: branchDefinition,
|
|
50
|
+
'error-on-no-global-key-translation': {
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
describe: 'Throw an error when there is no translation for a global key',
|
|
53
|
+
default: false
|
|
54
|
+
}
|
|
50
55
|
}),
|
|
51
56
|
handler: async options => {
|
|
52
57
|
await phrase.pull(options, config);
|
|
@@ -46,7 +46,12 @@ yargs__default["default"](process.argv.slice(2)).scriptName('vocab').option('con
|
|
|
46
46
|
}).command({
|
|
47
47
|
command: 'pull',
|
|
48
48
|
builder: () => yargs__default["default"].options({
|
|
49
|
-
branch: branchDefinition
|
|
49
|
+
branch: branchDefinition,
|
|
50
|
+
'error-on-no-global-key-translation': {
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
describe: 'Throw an error when there is no translation for a global key',
|
|
53
|
+
default: false
|
|
54
|
+
}
|
|
50
55
|
}),
|
|
51
56
|
handler: async options => {
|
|
52
57
|
await phrase.pull(options, config);
|
package/dist/vocab-cli.esm.js
CHANGED
|
@@ -39,7 +39,12 @@ yargs(process.argv.slice(2)).scriptName('vocab').option('config', {
|
|
|
39
39
|
}).command({
|
|
40
40
|
command: 'pull',
|
|
41
41
|
builder: () => yargs.options({
|
|
42
|
-
branch: branchDefinition
|
|
42
|
+
branch: branchDefinition,
|
|
43
|
+
'error-on-no-global-key-translation': {
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
describe: 'Throw an error when there is no translation for a global key',
|
|
46
|
+
default: false
|
|
47
|
+
}
|
|
43
48
|
}),
|
|
44
49
|
handler: async options => {
|
|
45
50
|
await pull(options, config);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vocab/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"main": "dist/vocab-cli.cjs.js",
|
|
5
5
|
"module": "dist/vocab-cli.esm.js",
|
|
6
6
|
"bin": {
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@types/env-ci": "^3.1.0",
|
|
17
|
-
"@vocab/core": "^1.
|
|
18
|
-
"@vocab/phrase": "^1.
|
|
17
|
+
"@vocab/core": "^1.5.0",
|
|
18
|
+
"@vocab/phrase": "^1.3.0",
|
|
19
19
|
"env-ci": "^5.0.2",
|
|
20
20
|
"fast-glob": "^3.2.4",
|
|
21
21
|
"form-data": "^3.0.0",
|