Skip to content

Configuration

{
"projectName": "MyProject",
"namespaces": {
"default": "translations/default.json",
"user": "translations/user.json",
"billing": "translations/billing.yaml"
},
"codegenPath": "generated",
"delivery": "split-by-locale",
"localeFallback": {
"en": null,
"de-DE": "en",
"de-CH": "de-DE",
"it": "en"
}
}

Under codegenPath/ codegen always writes:

  • i18n-types.generated.ts
  • instance.generated.ts
  • namespace-loaders.generated.ts
  • dictionary-schema.generated.ts

Type names are derived from projectName: MyProjectParams, MyProjectSchema, MyProjectLocale.

FieldDescription
projectNamePascalCase project id. Infers *Params / *Schema / *Locale (and *DeliveryArea for custom delivery).
namespacesMap of namespace → dictionary path (.json, .yaml, or .yml).
codegenPathDirectory for generated TypeScript modules (fixed basenames).
artifactsPathOptional. Directory for delivery JSON ({artifactsPath}/translations/). Defaults to codegenPath.
localeFallbackOptional locale → next locale | null map. See Locale fallback.
deliveryOptional. "split-by-locale" (default) or "custom". See Delivery.
deliveryArtifactsCustom delivery only. Map of area name → locale list (for example "eu": ["en", "it", "fr"]).
loaderStrategyOptional. "import" (default) or "fetch". Fetch requires createI18n({ fetchImpl }) / I18nRoot fetchImpl (resource id → JSON is app-owned) and enables CMS content updates without a types rebuild via regenerateNamespaces.

React bindings codegen (xndrjs-i18n-react-codegen) reads the same i18n.codegen.json. Optional i18n-react.codegen.json may set output for react-bindings.generated.tsx. See React.