New: Support for i18next v4

By Edouard on 29 septembre 2021

We’ve been updating WebTranslateIt so it now supports the newest version of i18next: version 4 😀

The new version of this library includes a breaking change to how plurals are handled. But I think this is for the best as they now use standard CLDR’s pluralisation format, and no unintelligible numbers. If you upgrade, please add a so-called magic comment featuring which version of i18next you are using in your JSON file, like so:

{
  "//": "i18next 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": ["multipe", "things"],
  "keyWithObjectValue": { "valueA": "return this with valueB", "valueB": "more text" }
}

So, WebTranslateIt now supports i18next 1, 2, 3 and 4. Thank you for reading!