The frontend and the language overlay
Add a module to the React client and keep English and Swedish in sync.
The web client is React and TypeScript, built with Vite, styled with the design tokens of the product. Each module is a file under web/src and is registered in the application shell with its system, its label and its icon.
Adding a module
- Create the module component in web/src.
- Register it in the application shell with the system it belongs to.
- Add the module to the system's group so it appears in the left menu.
- Add the translation keys to the English base.
- Add the Swedish overlay entry, not a second English string.
The language model
English is the base language. Swedish is an overlay: the same keys, translated. A missing overlay key falls back to English, which is acceptable; a Swedish string pasted into the English base is not, because it leaks into every other locale.
Design tokens
Do not invent colours or spacing inside a module. Use the shared tokens and the component library so a theme change applies everywhere. A module with hard-coded hex values is a module that will look wrong after the next theme update.
Seed data is data, not UI. Names, cities, addresses and skill lists in demo records are not translation leaks. Whitelist seed data before reporting a language bug.
Add a module, switch the language, and confirm the label changes with the overlay and falls back to English when the overlay key is missing.
Terms
- i18n
- Internationalisation: keeping user-facing strings in a key-based catalogue rather than in the code.
- Design token
- A named value for colour, spacing or type that components share.
OSMAINT Academy · Developer · The frontend and the language overlay · osmaint.org/academy/