i18next v26.4.5

v26.4.5
Fixed 3
  • hasLoadedNamespace(ns, { lng }) no longer stays false forever when the passed lng is loaded under another code or not at all, by checking the code the language is actually loaded under
  • For an lng outside supportedLngs, hasLoadedNamespace only waits for the fallback language, which is what t() resolves to
  • Prevents react-i18next useTranslation(ns, { lng }) from never becoming ready, which caused endless suspense retries and a loop in the load effect

From i18next

  • fix: hasLoadedNamespace(ns, { lng }) no longer stays false forever when the passed in lng is loaded under another code, or not at all. It checked the load state of the raw lng, but loadLanguages() stores a language under its resolved code (de-ch → de-CH, de-CH → de with load: 'languageOnly') and skips a lng outside supportedLngs entirely (only the fallback gets loaded), so that state never got set. react-i18next's useTranslation(ns, { lng }) then never became ready: with useSuspense it kept throwing an already resolved promise and React retried forever (100% CPU, SSR never finished), without it the load effect re-rendered in a loop. It now checks the code the language is actually loaded under, and for a lng outside supportedLngs only waits for the fallback, which is also what t() resolves to. Calls without lng and the precheck (react-i18next's bindI18n: 'languageChanging') are unchanged (react-i18next#1934).
View original

Upgraded? How did it go?

Discussion