Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

03 — User Journey (i18n Module)

End-to-end journeys around locale resolution, catalog delivery and translation management. Motion/interaction conventions per 00-shared/08; QA baseline per 00-shared/10.


1. J1 — App cold start in a supported locale (student Ravi, hi)

  1. Ravi opens the app; device sends Accept-Language: hi-IN, hi;q=0.9, en;q=0.8.
  2. I18nMiddleware takes the first tag, strips region and case: hi-INhi, whitelisted in SUPPORTED_LOCALES (i18n.middleware.ts:16-17, i18n.service.ts:11-21).
  3. App calls GET /api/v1/i18n/messages?locale=hi (JWT-authenticated, i18n.controller.ts:13-17); receives the full hi catalog.
  4. UI strings render in Hindi. Server-rendered messages (e.g. errors) use I18nService.translate() with the same resolved locale. Success: consistent Hindi everywhere.

2. J2 — Unsupported/absent locale (teacher with fr or no header)

  1. Middleware leaves ctx.locale unset (fr not in whitelist).
  2. getLocale() returns 'en' (i18n.service.ts:27-30).
  3. GET /i18n/messages returns the English catalog (getMessagesDEFAULT_CATALOG, i18n.service.ts:47-49). Success: graceful English fallback, never an empty payload.

3. J3 — Missing key in a shipped catalog (drift)

  1. Developer adds report.ready to en.json but not hi.json.
  2. A hi user triggers the message. translate('report.ready') finds no hi entry → falls back to DEFAULT_CATALOG (i18n.service.ts:37-40).
  3. User sees English inside an otherwise Hindi screen. Today: silent. (planned): CI drift check (IMPLEMENTATION_PLAN.md:845) fails the build so this never ships.

4. J4 — Translation manager edits a key (planned)

  1. Aarav opens the (planned) translation console, filters locale ta, status missing.
  2. Edits the key in the per-locale editor (06_Screen_Specifications.md §2).
  3. Saves → validation checks placeholders match the en source (08_Form_Specifications.md §2) → updated catalog published.
  4. Next app fetch (GET /i18n/messages) returns the new string. (Publishing mechanics — file/DB, per-tenant or global — are (planned) and unresolved; see 00-shared/12.)

5. J5 — New locale onboarding (planned)

  1. Platform admin adds locale kn to the locale-management screen.
  2. Catalog created empty → all keys show missing.
  3. Translators fill in; when a coverage threshold is met, kn is promoted to SUPPORTED_LOCALES — today this is a code+deploy change (i18n.service.ts:9-21 is a code constant).

6. Journey map

StepActorSystem actionOutcome
Header sentdevicemiddleware whitelist checklocale or en
Fetch catalogappGET /i18n/messages?locale=full catalog, fallback en
Render stringapp/serverkey lookup + {param} filllocalized text
Missing keycatalog → en → keynever-empty guarantee
Edit key (planned)adminconsole CRUDnext fetch serves it