summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2021-07-22 12:57:31 +0300
committerPaul Fertser <fercerpav@gmail.com>2021-07-22 17:52:42 +0300
commite827dd235bb4c459a5320ad00c0b0ba7b8bd0468 (patch)
treecbde2cf2df0d523fa1033cf9c7e20e5213983124 /docs
parent8b1beffd683a400eec8454ac155f84f0ebcd3f3f (diff)
downloadwebui-vue-e827dd235bb4c459a5320ad00c0b0ba7b8bd0468.tar.xz
docs: expand guide with vue-i18n-extract.js examples
This internationalization documentation patch provides the developers with specific recommendations on using vue-i18n-extract.js tool to ensure translations consistency. Signed-off-by: Paul Fertser <fercerpav@gmail.com> Change-Id: I506091c97043ad3f50c4753daddd450abe9744fc
Diffstat (limited to 'docs')
-rw-r--r--docs/guide/guidelines/internationalization.md19
1 files changed, 16 insertions, 3 deletions
diff --git a/docs/guide/guidelines/internationalization.md b/docs/guide/guidelines/internationalization.md
index c407edc1..6ff17d76 100644
--- a/docs/guide/guidelines/internationalization.md
+++ b/docs/guide/guidelines/internationalization.md
@@ -23,10 +23,23 @@ provides to our components) for outputting translation messages.
## Using the Vue I18n plugin
- A new `src/i18n.js` file is added and it registers Vue I18n as a plugin to
our Vue instance via the `Vue.use()` function.
-- The CLI creates a `src/locales/en.json` file, which contains our default
+- The CLI creates a `src/locales/en-US.json` file, which contains our default
translation messages.
-- The keys are placed in the `src/locales/en.json` file and then the `$t()`
+- The keys are placed in the `src/locales/en-US.json` file and then the `$t()`
function is used to output the translation messages.
+- After adding or removing calls to `$t` please run this to ensure consistent
+English translation (note: using variable expansion in key names is not
+handled automatically, you need to manually check them):
+```bash
+node node_modules/vue-i18n-extract/bin/vue-i18n-extract.js -v 'src/**/*.?(js|vue)' -l 'src/locales/en-US.json'
+```
+- If you're working on updating a translation for another language (e.g.
+Russian), run this to see the omissions (as well as cruft) and add the
+necessary keys automatically:
+```bash
+node node_modules/vue-i18n-extract/bin/vue-i18n-extract.js -v 'src/**/*.?(js|vue)' -l 'src/locales/ru-RU.json' -a
+```
+
```json
"pageDumps": {
"dumpsAvailableOnBmc": "Dumps available on BMC"
@@ -54,4 +67,4 @@ this.$bvModal
okTitle: this.$tc('pageDumps.modal.deleteDump'),
cancelTitle: this.$t('global.action.cancel'),
})
-``` \ No newline at end of file
+```