Packages
@routess/i18n
Translation service with en/nl/fr/de support.
A small i18n service that's framework-agnostic and reused across web and mobile.
Supported languages
- English (
en), the default - Dutch (
nl) - French (
fr) - German (
de)
Usage
import { createI18nService } from "@routess/i18n";
import { logger } from "@routess/core";
const i18n = createI18nService(logger);
i18n.setLocale("nl");
i18n.t("nav.signIn"); // → "Inloggen"
i18n.t("greeting", { name: "Robbe" }); // → "Hallo, Robbe!"Locales structure
packages/i18n/src/locales/
├── en.ts
├── nl.ts
├── fr.ts
└── de.tsEach locale exports a flat object of keys.
Adding a key
- Add the key to every locale file (start with
en.ts) - Use
i18n.t("your.key")in code - The TypeScript types auto-update; missing translations show up as type errors
Adding a locale
- Add
xx.tsinsrc/locales/with all keys translated - Register the locale in the service factory
- Add the language to the docs site
i18n.tsif you want User Guide translations too