Locale Files
Kanjou expects your locale data to be defined in standard JSON or JavaScript/TypeScript files (.json, .ts, .js, .mts, .mjs).
Directory Structure
You should keep all your locale files in a dedicated directory. This directory is then specified as localesDir in your kanjou.config.ts.
src/
└── locales/
├── en.ts
├── es.ts
└── fr.tsDictionary Format
Each file should export a flat object where the keys are your translation identifiers, and the values are standard MessageFormat 2 strings.
Flat Structure Only
Locale dictionaries MUST be flat key-value objects. Nested objects (e.g. { "nav": { "home": "Home" } }) are strictly NOT supported and will cause compiler and runtime parser failures. Always use dot-notation for namespacing (e.g. "nav.home": "Home").
export default {
'greeting': 'Hello, {$name}!',
'nav.home': 'Home',
'nav.about': 'About Us',
'errors.notFound': 'Page not found.',
} as constFile Naming Conventions
The filename (excluding the extension) determines the locale identifier used in your code and Vite virtual module imports.
en.ts-> Localeenes-AR.json-> Localees-AR
You MUST specify a baseLocale (e.g. en.ts or 'en') in your kanjou.config.ts. Kanjou requires it as the single source of truth for generating strict TypeScript definitions and validating keys across your application.