Overview
createI18n gives you typed access to KavachOS’s built-in translation strings. Use it to return localized error messages to users, translate email subjects, or power a multi-language UI.
Setup
defaultLocale. You can override it per-request (see below).
Built-in locales
Translating a string
Variable interpolation
Pass a variables object as the second argument. Variables are referenced with{{name}} in translation strings.
Per-request locale
Detect the user’s locale from theAccept-Language header and pass it to each call:
Adding a custom locale
Register additional locales at runtime by passing alocales map:
defaultLocale.
Missing keys always fall back to the
defaultLocale value rather than throwing. This means partial translations are safe to ship.Translation key reference
Next steps
Email templates
Built-in HTML templates for every auth flow.
Error reference
Full list of KavachOS error codes.