Skip to main content

@amisi-mobile-starter/i18n

@amisi-mobile-starter/i18n ships one locale, en, and typed keys for a11y, auth, chat, common, docs, emptyStates, errors, home, legal, navigation, onboarding, paywall, profile, subscriptions, and validation.

Add the provider

I18nProvider accepts only children and starts with en.

Translate in React

useAppTranslation() must run inside I18nProvider. It returns t and an i18n object with language and changeLanguage(locale: string): Promise<void>. Unsupported locales are ignored. Translation options are exact:
Values replace {{name}} placeholders. Missing keys return defaultValue or the key itself.

Translate outside React

The module-level setLocale and t use module-level locale state. Provider locale state is separate. Trans accepts only i18nKey and optional values; it renders the module-level t result and does not support component interpolation.

Locale source

English JSON lives at packages/i18n/src/locales/en/*.json. Add a key to the matching keyset under packages/i18n/src/keyset and to the corresponding English resource. The runtime currently does not register any other locale.