For the complete documentation index, see llms.txt. This page is also available as Markdown.

JSON Format

The i18next JSON formats v1 to v4: plural and context suffixes, nesting and arrays, and how to convert between versions.

Do you prefer the ICU format? Then use the i18next-icu plugin.

i18next JSON v4

{
  "key": "value",
  "keyDeep": {
    "inner": "value"
  },
  "keyNesting": "reuse $t(keyDeep.inner)",
  "keyInterpolate": "replace this {{value}}",
  "keyInterpolateUnescaped": "replace this {{- value}}",
  "keyInterpolateWithFormatting": "replace this {{value, format}}",
  "keyContext_male": "the male variant",
  "keyContext_female": "the female variant",
  "keyPluralSimple_one": "the singular",
  "keyPluralSimple_other": "the plural",
  "keyPluralMultipleEgArabic_zero": "the plural form 0",
  "keyPluralMultipleEgArabic_one": "the plural form 1",
  "keyPluralMultipleEgArabic_two": "the plural form 2",
  "keyPluralMultipleEgArabic_few": "the plural form 3",
  "keyPluralMultipleEgArabic_many": "the plural form 4",
  "keyPluralMultipleEgArabic_other": "the plural form 5",
  "keyWithArrayValue": ["multiple", "things"],
  "keyWithObjectValue": { "valueA": "return this with valueB", "valueB": "more text" }
}

These are the defaults. Nesting and Interpolation formats are configurable.

To learn more about the features check the documentation:

The only difference to v3 is the plural suffixes.

You may need to polyfill the Intl.PluralRules API (e.g. React Native on Hermes). Since i18next v24 there is no fallback to the v3 plural handling anymore: without Intl support an error is logged and only English-style _one/_other suffixes are resolved.

To convert your existing translations to the new v4 format, have a look at i18next-v4-format-converter or this web tool. (It will only handle keys with the default pluralSeparator _)

i18next JSON v3

enabled by (i18next v21-v23 only; the compatibilityJSON escape hatch for old formats was removed in v24):

formats:

The only difference to v2 is the plural suffixes for languages with multiple plural forms.

i18next JSON v2

enabled by:

formats:

These are the defaults. Nesting and Interpolation formats are configurable.

i18next JSON v1

enabled by:

formats:

These are the defaults. Nesting and Interpolation formats are configurable.

You can check your i18next JSON files for missing translations, duplicate source values and interpolation placeholder mismatches with the free i18n health check.

Last updated