- fix:
setDefaultNamespace()works on a clone. A clone's translator keeps its own options object, so the call changedi18n.options.defaultNSwhilet()kept using the old default namespace. i18next-http-middleware hands every request a clone, soreq.i18n.setDefaultNamespace()did nothing there. (#2106) - fix:
supportedLngsworks in any casing. Every other language code is formatted (pt-brtopt-BR,ENtoen, all lowercase withlowerCaseLng), butsupportedLngswas compared as written, sosupportedLngs: ['pt-br'],['EN'], or['pt-BR']withlowerCaseLng: truerefused that language and fell back. They are now compared in that formatted form (also byloadLanguages()), whileoptions.supportedLngsstays as written. (#1791) - fix(types): resources typed with named
interfaces get their nested keys. The key types only walked into objects with an index signature, which a type alias has and an interface does not, sot('nested.key')failed with TS2345 whilet('nested')compiled. Interfaces now give the same keys as type aliases, sot('nested')withoutreturnObjectsis rejected for them too. (#2326) - fix(types): typed keys work with
strictNullChecks: false. Without strict null checksundefinedpassesextends string, so the key prefix, namespace and context checks took a missingkeyPrefix,nsorcontextfor a value:t('title')was rejected (onlyt('ns:title')compiled),t()returnedstring, and react-i18next'sTransaccepted noi18nKey. A new type test project compiles withstrictNullChecks: false; with strict null checks the types resolve as before. (#2085)