@vocab/cli
Advanced tools
Comparing version 1.3.7 to 1.4.0
@@ -49,3 +49,8 @@ 'use strict'; | ||
builder: () => yargs__default["default"].options({ | ||
branch: branchDefinition | ||
branch: branchDefinition, | ||
'error-on-no-global-key-translation': { | ||
type: 'boolean', | ||
describe: 'Throw an error when there is no translation for a global key', | ||
default: false | ||
} | ||
}), | ||
@@ -52,0 +57,0 @@ handler: async options => { |
@@ -49,3 +49,8 @@ 'use strict'; | ||
builder: () => yargs__default["default"].options({ | ||
branch: branchDefinition | ||
branch: branchDefinition, | ||
'error-on-no-global-key-translation': { | ||
type: 'boolean', | ||
describe: 'Throw an error when there is no translation for a global key', | ||
default: false | ||
} | ||
}), | ||
@@ -52,0 +57,0 @@ handler: async options => { |
@@ -42,3 +42,8 @@ import { push, pull } from '@vocab/phrase'; | ||
builder: () => yargs.options({ | ||
branch: branchDefinition | ||
branch: branchDefinition, | ||
'error-on-no-global-key-translation': { | ||
type: 'boolean', | ||
describe: 'Throw an error when there is no translation for a global key', | ||
default: false | ||
} | ||
}), | ||
@@ -45,0 +50,0 @@ handler: async options => { |
{ | ||
"name": "@vocab/cli", | ||
"version": "1.3.7", | ||
"version": "1.4.0", | ||
"main": "dist/vocab-cli.cjs.js", | ||
@@ -17,4 +17,4 @@ "module": "dist/vocab-cli.esm.js", | ||
"@types/env-ci": "^3.1.0", | ||
"@vocab/core": "^1.4.0", | ||
"@vocab/phrase": "^1.2.8", | ||
"@vocab/core": "^1.5.0", | ||
"@vocab/phrase": "^1.3.0", | ||
"env-ci": "^5.0.2", | ||
@@ -21,0 +21,0 @@ "fast-glob": "^3.2.4", |
@@ -509,2 +509,34 @@ # Vocab | ||
#### Global key | ||
`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. | ||
```jsonc | ||
// translations.json | ||
{ | ||
"Hello": { | ||
"message": "Hello", | ||
"globalKey": "hello" | ||
}, | ||
"Goodbye": { | ||
"message": "Goodbye", | ||
"globalKey": "app.goodbye.label" | ||
} | ||
} | ||
``` | ||
In the above example, | ||
- `vocab push` will push the `hello` and `app.goodbye.label` keys to Phrase. | ||
- `vocab pull` will pull translations from Phrase and map them to the `hello` and `app.goodbye.label` keys. | ||
##### Error on no translation for global key | ||
By default, `vocab pull` will not error if a translation is missing in Phrase for a translation with a global key. | ||
If you want to throw an error in this situation, pass the `--error-on-no-global-key-translation` flag: | ||
```sh | ||
vocab pull --error-on-no-global-key-translation | ||
``` | ||
## Troubleshooting | ||
@@ -511,0 +543,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25520
238
551
Updated@vocab/core@^1.5.0
Updated@vocab/phrase@^1.3.0