Skip to main content

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

The active locale defaults to 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 the Accept-Language header and pass it to each call:

Adding a custom locale

Register additional locales at runtime by passing a locales map:
Custom locales merge with the built-in keys. Any key you do not supply falls back to 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.
Last modified on April 29, 2026