Add i18n vendor overlays and dynamic bundling
- Add opt-in vendor overlays under src/env/locales/<env>
(and optional variant), merged on top of base locales at runtime.
- Auto-discover and bundle all base locale JSON files
in src/locales/.
- Example: move dump type labels under pageDumps.dumpTypes;
read vendor-only dump labels from overlays.
- Docs: update i18n guidelines and env README (formatting fixes).
- Tests: add focused unit tests for overlays and locale aliases.
Tested:
- Unit: i18n.locale-alias.spec.js, i18n.vendor.spec.js (passing)
- Manual: Verified dynamic locale discovery and overlay merge in UI
Change-Id: I8eae2bfec0e9622bafdafac3168dbf96650e8ae8
Signed-off-by: jason westover <jwestover@nvidia.com>
diff --git a/tests/unit/i18n.locale-alias.spec.js b/tests/unit/i18n.locale-alias.spec.js
new file mode 100644
index 0000000..bfcacbf
--- /dev/null
+++ b/tests/unit/i18n.locale-alias.spec.js
@@ -0,0 +1,36 @@
+// How to run this test in isolation:
+// npm run test:unit -- i18n.locale-alias.spec.js
+
+describe('i18n locale aliases', () => {
+ test('resolves pageLogin.language for en (alias to en-US)', async () => {
+ const { createI18nInstance } = await import('@/i18n');
+ const base = require('@/locales/en-US.json');
+ const loadBase = () => ({ 'en-US': base.default || base });
+ const i18n = createI18nInstance(undefined, 'en', undefined, loadBase);
+ expect(i18n.global.t('pageLogin.language')).toBe('Language');
+ });
+
+ test('resolves pageLogin.language for en-US', async () => {
+ const { createI18nInstance } = await import('@/i18n');
+ const base = require('@/locales/en-US.json');
+ const loadBase = () => ({ 'en-US': base.default || base });
+ const i18n = createI18nInstance(undefined, 'en-US', undefined, loadBase);
+ expect(i18n.global.t('pageLogin.language')).toBe('Language');
+ });
+
+ test('resolves pageLogin.language for ka (alias to ka-GE)', async () => {
+ const { createI18nInstance } = await import('@/i18n');
+ const base = require('@/locales/ka-GE.json');
+ const loadBase = () => ({ 'ka-GE': base.default || base });
+ const i18n = createI18nInstance(undefined, 'ka', undefined, loadBase);
+ expect(i18n.global.t('pageLogin.language')).toBe('ენა');
+ });
+
+ test('resolves pageLogin.language for ka-GE', async () => {
+ const { createI18nInstance } = await import('@/i18n');
+ const base = require('@/locales/ka-GE.json');
+ const loadBase = () => ({ 'ka-GE': base.default || base });
+ const i18n = createI18nInstance(undefined, 'ka-GE', undefined, loadBase);
+ expect(i18n.global.t('pageLogin.language')).toBe('ენა');
+ });
+});