i18next v26.4.0

v26.4.0
Changed 4
  • Cache `toResolveHierarchy` results per `(code, fallbackCode)` pair to reduce per-call overhead from ~886 ns to ~41 ns in render-heavy UIs
  • Invalidate the hierarchy cache automatically when `options.fallbackLng` changes through reassignment or in-place array mutation
  • Require calling `i18next.services.languageUtils.clearCache()` manually after runtime mutations of resolution-relevant options (`load`, `lowerCaseLng`, `cleanCode`, `nonExplicitSupportedLngs`)
  • Update all devDependencies and replace `sinon` with `nise` + `vitest.spyOn` in v1 compatibility tests

From i18next

  • perf: cache toResolveHierarchy results per (code, fallbackCode) pair. The hierarchy resolver runs on every t() call and calls Intl.getCanonicalLocales multiple times, which showed up prominently when profiling render-heavy UIs (e.g. virtualized data grids); with the cache the per-call cost drops from ~886 ns to ~41 ns. The cache is invalidated automatically when options.fallbackLng changes (reassignment or in-place array mutation); if you mutate other resolution-relevant options at runtime (load, lowerCaseLng, cleanCode, nonExplicitSupportedLngs), call i18next.services.languageUtils.clearCache() afterwards. Function-valued fallbackLng and per-call array/object fallbackLng options are never cached, so dynamic fallbacks keep working as before. Thanks @equaterina (#2444).
  • chore: update all devDependencies (Babel stays on 7.x until @rollup/plugin-babel supports 8, eslint on 9.x for neostandard). Removed the unused coveralls package (CI uses the Coveralls GitHub Action) and replaced sinon with nise + vitest.spyOn in the v1 compatibility tests, which resolves all open npm audit findings (0 vulnerabilities) and should close the dependabot alerts on the lockfile.
View original

Upgraded? How did it go?

Discussion