language detectors can return an array of languages and let i18next figure out best match
rename option whitelist to supportedLngs
rename option nonExpicitWhitelist to nonExplicitSupportedLngs
rename function languageUtils.isWhitelisted to languageUtils.isSupportedCode
This changes are made with temporal backwards compatiblity and will warn your for deprecated usage of old terms to give users and plugin providers some time to adapt their code base.
The temporal backwards compatiblity will be removed in a follow up major release.
Learn more about why this change was made here.
ReadCallback
1439options.interpolation.nestingOptionsSeparator
options.interpolation.nestingOptionsSeparator: ','
to specify that separatorexport default
for esm-first
approach 1352t
for better performanceWhen calling i18next.changeLanguage()
both
i18next.language
and i18next.languages
will be
set to the new language after calling loadResources
->
means when accessing t
function meanwhile you will get
still the translations for the previous language instead of the
fallback.
When is this breaking? this does not break any current test - but if you depend on accessing i18next.language or i18next.dir during language change and expect the new language this will break your app.
Reasoning: In react-i18next we get in a not ready state for loaded translations while we would prefer just waiting for the new language ready and trigger a rerender then - also a triggered rerender outside of the bound events would end in Suspense…
How can I get the language i18next will be set to?
i18next.isLanguageChangingTo
is set to the language
called
cleanCode
option to TypeScript
def 1344DX improvements:
Both are a clear sign you render your app / call t to early not waiting for the callbacks or Promise.resolve on i18next.init, i18next.loadNamespace or i18next.changeLanguage.
use(module)
types 1296const i18next = require('i18next').default;
import { changeLanguage } from 'i18next'; changeLanguage('de');
you will have to
import i18next from 'i18next'; i18next.changeLanguage('de');
transEmptyNodeValue
to ReactOptions
1166BREAKING:
tDescription
to the t
options or as a third
param to calling t
->
t(key, defaultValue, tDescription);
. Those will get
forwarded to the backend and can be submitted on saveMissing to provide
contextual information for translators._0
on languages only
having “singular” form_0
on languages only having
“singular” form enables easier convert in tool chainsi18next.t('key', { nest: false })
PR920[BREAKING] Removed special cases for norwegian which resolved nb-NO to nb-NO, no will now resolve to nb-NO, nb #870 using norwegian you could migrate to old behaviour like:
fallbackLng: { ‘nb’: [‘no’, ‘en’], ‘nn’: [‘no’, ‘en’], ‘default’: [‘en’] }
adding exports for named import (destruction es6) #873
change entry point for umd build to /src/i18next to avoid mixed export
replace cloning in interpolation nesting to use object assign instead of json.stringify/parse so circular structures can be used #875
update all build dependencies
Setting options on individual translations override, rather than merge global configs #832
Create an new translator when cloning i18next instance #834
allows fallbackLng to be an string, an array or an object defining fallbacks for lng, lng-region plus default, eg
fallbackLng: { ‘de-CH’: [‘fr’, ‘it’, ‘en’], ‘de’: [‘fr’, ‘en’], ‘zh-Hans’: [‘zh-Hant’, ‘en’], ‘zh-Hant’: [‘zh-Hans’, ‘en’], ‘default’: [‘en’] }
nonExplicitWhitelist
on init #741initImmediate (default: true)
to init
without immediateresource
to resources
in addResources
function PR
440en-us
->
en-US