From e827dd235bb4c459a5320ad00c0b0ba7b8bd0468 Mon Sep 17 00:00:00 2001
From: Paul Fertser <fercerpav@gmail.com>
Date: Thu, 22 Jul 2021 09:57:31 +0000
Subject: 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
---
docs/guide/guidelines/internationalization.md | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
(limited to 'docs/guide')
diff --git a/docs/guide/guidelines/internationalization.md b/docs/guide/guidelines/internationalization.md
index c407edc10..6ff17d761 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
+```
--
cgit v1.2.3