Sourced from react-i18next's changelog.
17.0.21
- fix(IcuTrans): explicit
valuesnow win overinterpolation.defaultVariables, as they do int().IcuTransmerged them the other way round, so<IcuTrans values={{ user: 'John Doe' }} />rendered the configured default variableuserinstead ofJohn Doe.Transhad the same inverted merge and is fixed too. Compatibility note: only names that are set both invaluesand indefaultVariablesrender differently.- feat: new entry point
react-i18next/IcuTransWithoutContext(with types) for React Server Components. ImportingIcuTransWithoutContextfromreact-i18nextin a Server Component could fail the build withcreateContext is not a function, because the main entry creates the React context when it is loaded. Likereact-i18next/TransWithoutContext, the new entry point does not.- fix(build): the ESM build's
dist/es/package.jsonnow declares"sideEffects": false, like the rootpackage.jsonalready did. Bundlers use the nearestpackage.json, so the ESM build counted as having side effects and unused exports were kept: an app that only usesTransstill bundledIcuTranswith its HTML entity decoder,useTranslationanduse-sync-external-store. With esbuild, aTrans-only bundle (React and i18next external) goes from 20.9 KB to 11.6 KB minified, 8.3 KB to 5.0 KB gzipped.- docs: the
icu.macroBabel macro is now marked as deprecated in favour of usingIcuTransdirectly. It fails on Babel 8 (t.jSXIdentifier is not a function),<Plural count={count}>renders the raw ICU message, and a Reactkeyon<Plural>/<Select>becomes an ICU case. It keeps working on Babel 7 and is not removed. TheIcuTransdocs page has a corrected example and props table and covers Server Components.17.0.20
- fix:
useTranslationno longer suspends when a missing namespace is loaded by a synchronous backend. WithuseSuspense(the default), a namespace that wasn't in the store yet always made the component throw the loading promise, even when the backend had already delivered the resources while that promise was being created. React then showed theSuspensefallback and rendered again right away, which appears as a fallback flash (a white flash in React Native) and costs performance. The hook now starts the load first, checks the store again and only suspends if the namespace is still missing. This helps every backend that calls back synchronously, for examplei18next-resources-to-backendwith a static resources object or a loader that returns the data directly. Async backends, and an instance that isn't initialized yet, still suspend as before. Thanks@oblador(#1937).