README.md
1# Vendor locale overlays
2
3This directory contains environment/vendor-specific translation bundles that are
4merged on top of the base, vendor-neutral locales in `src/locales/`.
5
6## Structure
7
8```text
9src/env/locales/
10 <vendor>/
11 en-US.json
12 ka-GE.json
13 ru-RU.json
14 zh-CN.json
15 <vendor-variant>/
16 en-US.json # optional, only when variant overrides vendor root
17 ka-GE.json # optional
18 ru-RU.json # optional
19 zh-CN.json # optional
20```
21
22Examples:
23
24- Shared vendor folder: `src/env/locales/nvidia/`
25- Variant folder: `src/env/locales/nvidia-gb/`
26
27## Merge order at runtime
28
291. Base locales from `src/locales/` (auto-discovered)
302. Vendor root overlays (e.g., `src/env/locales/nvidia/`)
313. Variant overlays (e.g., `src/env/locales/nvidia-gb/`)
32
33Variant keys overwrite vendor root keys on conflict.
34
35## Guidelines
36
37- Keep `src/locales/` vendor‑neutral. Put vendor‑specific strings here.
38- Prefer the vendor root folder when multiple projects share strings to avoid
39 duplication.
40- Only add a variant folder if it truly needs to override vendor root strings.
41- File names must match locale codes (e.g., `en-US.json`, `ru-RU.json`,
42 `zh-CN.json`, `ka-GE.json`).
43- Use 4‑space indentation; alphabetize object keys for readability.
44- JSON must be valid (no trailing commas or comments).
45
46## Environment selection
47
48The active environment is selected by `VUE_APP_ENV_NAME` (e.g., `nvidia`,
49`nvidia-gb`). See the `.env.*` files at the repo root (e.g., `.env.nvidia-gb`).
50
51## Bundling
52
53- All JSON files under `src/locales/` are bundled automatically.
54- Matching overlays under `src/env/locales/<env>` are also bundled and merged at
55 app start.
56
57## Testing
58
59Focused unit tests exist for overlays and fallback:
60
61- `npm run test:unit -- i18n.vendor.spec.js`
62- `npm run test:unit -- i18n.locale-alias.spec.js`
63
64These verify vendor root → variant merge behavior and locale alias handling.
65