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

01 — Product Overview (i18n Module)

Backend + app-facing view of StudyLyon's internationalization. Grounded in src/shared/i18n/ and src/modules/i18n/; shared conventions per 00-shared/01, 00-shared/05.


1. What this module is

StudyLyon ships an i18n framework: a request-scoped locale resolver (I18nMiddleware), a translation service with per-locale JSON catalogs and English fallback, and one authenticated API endpoint that serves the message catalog for the resolved locale.

2. What it is today (implemented)

CapabilityStatusSource
Locale resolution from Accept-Languagelivesrc/shared/i18n/i18n.middleware.ts:13-18
Translation lookup + {param} interpolationlivesrc/shared/i18n/i18n.service.ts:32-45
Message catalog endpointlivesrc/modules/i18n/i18n.controller.ts:13-17
Catalogs: en, hi shippedlivesrc/shared/i18n/translations/
7 further locales declaredplanned (data-only)i18n.service.ts:9-21
Admin translation editor / key CRUD(planned)no code — IMPLEMENTATION_PLAN.md:171
Crowdin + CI drift check(planned)IMPLEMENTATION_PLAN.md:845

3. Storage model

Translations are static JSON files compiled into an in-memory CATALOGS record at boot (i18n.service.ts:6). There is no MongoDB collection for translations, and catalogs are global — not tenant-scoped (deliberate: UI strings are product-owned, tenant data is not). See 04_Information_Architecture.md.

4. Product value

  • One codebase, 9 target Indian locales (en, hi, ta, te, kn, ml, gu, mr, bn).
  • API responses, notification copy and (planned) app UI in the user's language without per-tenant translation data.
  • Fallback chain guarantees a string is always returned, even when a translation is missing (i18n.service.ts:40).

5. Scope boundary — PRD native-app exclusion

The original PRD scoped the web/API platform and explicitly excluded the native mobile app. These design docs cover the mobile/Flutter surface introduced later (see 00-shared/11_Flutter_App_Architecture.md) plus the admin console surfaces for translation management (planned). The server-side i18n service itself is in production scope and fully described in 12_API_Mapping.md.

6. Non-goals (today)

  • Per-tenant custom translations (no tenantId on catalogs).
  • Runtime translation editing (catalogs are static; editing is (planned)).
  • Right-to-left locales (all 9 supported locales are LTR; RTL is (forward-looking) — see 07_Component_Library.md).
  • Translation of tenant-authored content (announcement bodies, thread titles) — that is content, not UI strings.

7. Definitions

  • Locale — lowercase BCP-47 primary tag, e.g. en, hi, ta.
  • Catalog — one JSON file of key → string pairs per locale.
  • Key — dotted path, e.g. errors.resourceNotFound.
  • Interpolation{name} placeholders substituted at translate time (i18n.service.ts:42-44).