0014. i18next for UI strings, merged with translations shipped by Components
Generated from front/docs/adr/0014-i18next-with-shared-component-translations.md
- Status: Accepted (retroactive)
- Date: 2021-09-17 (i18next); 2022-06-07 (merge with Components resources)
Context and Problem Statement
Section titled “Context and Problem Statement”Wellms is used by Polish and international customers; the demo has to be translatable,
and since 2022 part of the UI comes from @escolalms/components, which has its own strings.
Considered Options
Section titled “Considered Options”Not recorded.
Decision Outcome
Section titled “Decision Outcome”i18next + react-i18next, initialised in src/i18n.ts with in-code resource objects.
Since 2022-06 the front spreads resources exported by
@escolalms/components/lib/styleguide/i18n into its own en/pl resources and overrides
or extends keys locally. No language detector or lazy-loaded JSON namespaces are used.
Consequences
Section titled “Consequences”- Good: one i18n instance for app and library components; library strings can be overridden per app.
- Bad:
src/i18n.tsis a single ~65 KB TypeScript file bundled into the main chunk; translators must edit code.
Evidence
Section titled “Evidence”6cb7cc442021-09-17 “copied” -front/package.json(i18next),front/src/i18n.ts51f07daa2021-11-04 “update i18next”7a2db0352022-06-07 “my data edit form (#194)” - firstComponentTranslationsimport infront/src/i18n.ts70a9fc702022-06-29 “feature/translations, fix courses slider (#256)”- Components repo:
01dccef2022-04-26 “i18n (#13)”