chore(deps): Update dependency react-i18next to v18 - autoclosed #332

Closed
renovate wants to merge 1 commit from renovate/react-i18next-18.x into main
Collaborator

This PR contains the following updates:

Package Change Age Confidence
react-i18next ^17.0.9 → ^18.0.0 age confidence

Release Notes

i18next/react-i18next (react-i18next)

v18.0.1

Compare Source

  • fix(types): declare @types/react as an optional peer dependency. The type declarations import from react, and with pnpm's global virtual store (virtualStoreType: global) TypeScript resolved that to the untyped react/index.js, so every React type in them became any: wrong props compiled, callback parameters failed with TS7006. Under the default pnpm layout it only worked through pnpm's hidden hoisting. The range is *, so projects without TypeScript install nothing extra and an older @types/react does not make npm fail (#​1948)
  • requires i18next 27.0.1 or later (peer >= 27.0.1), which keeps at most 1000 formatters in each cached format

v18.0.0

Compare Source

Released together with i18next 27. The migration guide lists every change with what to do: https://react.i18next.com/latest/migrating-v17-to-v18

Breaking changes
  • requires i18next 27 (peer >= 27.0.0) and React 18 or later (peer >= 18.0.0). React 16 and 17 apps stay on react-i18next 17: on i18next 27, use react-i18next 17.1.13 or later (it brings the types of the react init options), or 18. useSyncExternalStore comes from React itself, so use-sync-external-store is no longer a dependency.
  • Trans output no longer depends on interpolation.escapeValue: it always decodes HTML entities after parsing, as IcuTrans does, in text and in attribute values, both with react.unescape (attribute values used the built-in decoder before). With i18next's default escapeValue: true, a value Tom & Jerry rendered as Tom & Jerry and a date 17/12/2025 as 17/12/2025; both now render as written, and so do entities in the translation itself (&, <,  , ...). Values still render as text, never as markup (since 17.1.10). The shouldUnescape prop and react.transDefaultProps.shouldUnescape are ignored and warn (DEPRECATED_OPTION, in development and with debug: true); remove them. Snapshot tests that contain entities inside Trans output need an update (#​1903, #​1893).
  • Trans and IcuTrans re-render on language change by themselves: they subscribe to the react.bindI18n (default languageChanged) and react.bindI18nStore events, like useTranslation. Before, they only updated when a parent re-rendered (#​1710). They still neither load translations nor suspend; with a t prop, that t still decides the language. TransWithoutContext and IcuTransWithoutContext stay hook-free.
  • the react options of an instance stay on that instance. initReactI18next copied them into module-wide defaults, so a second instance without react options inherited, for example, the first one's useSuspense: false. Set them on every instance, or call setDefaults() once.
  • the i18n returned by useTranslation (and passed by withTranslation and Translation) forwards reads and writes to the instance. It was a copy taken when the language changed, so after await i18n.changeLanguage('de') the copy still said en, and properties set on it never reached the instance. It is still a new object whenever the language changes, for dependency arrays and the React Compiler. Because the old object now reads the current language too, a check like prevProps.i18n.language !== this.props.i18n.language (or the language of a usePrevious(i18n)) no longer sees a change: compare the objects (prevProps.i18n !== this.props.i18n) or keep the previous language yourself.
  • useSSR and withSSR call i18next's hydrate() instead of writing resourceStore.data, options.ns, initializedStoreOnce, isInitialized and initializedLanguageOnce themselves. Same behavior with real instances, including the opt-out for cloned instances. Test mocks of i18n used with useSSR/withSSR now need a hydrate method, mocks that load before init() need once, and mocks used with Trans or IcuTrans need on and off, since both subscribe to events now (with bindI18nStore set, also store.on and store.off): a minimal mock like { t, options, language } throws i18n.on is not a function.
  • the react-i18next/icu.macro Babel macro (deprecated since 17.0.21) is removed, with the placeholder exports date, time, number, select, plural and selectOrdinal. Write IcuTrans directly.
  • types: the HTMLAttributes['children'] augmentation for allowObjectInHTMLChildren moved to the opt-in react-i18next/augment-react. Default installs no longer change React's DOM types. With allowObjectInHTMLChildren: true, add import 'react-i18next/augment-react'; next to your CustomTypeOptions; with current @types/react it needs skipLibCheck: true (#​1928).
  • types: I18nContext is typed { i18n: i18n; defaultNS?: string | string[] } | undefined, as at runtime: useContext(I18nContext) is undefined outside an I18nextProvider. getI18n() keeps its type.
  • types: react-i18next now declares the react init options. i18next 27 keeps an empty ReactOptions interface that react-i18next fills in, so import type { ReactOptions } from 'i18next' keeps working, and ReactOptions is also exported from react-i18next. The defaultTransParent docs no longer claim a 'div' default.
  • the UMD build no longer bundles i18next: it uses the global i18next (load i18next's UMD build first) and shrinks from 71.3 KB to 26.2 KB minified. The AMD build (dist/amd) is removed; AMD loaders can use the UMD file.
  • engines.node is >=22, and the build targets ES2020 syntax with a fixed browser list instead of browserslist defaults.
Other changes
  • feat: a react-server export condition for react-i18next. In a React Server Component, import { Trans } from 'react-i18next' failed with createContext is not a function; it now resolves to an entry with Trans and IcuTrans (the variants without React context), TransWithoutContext, IcuTransWithoutContext, nodesToString, initReactI18next, setI18n/getI18n and setDefaults/getDefaults. Hooks, HOCs, Translation, I18nextProvider and the SSR helpers stay client-only, so importing them there is a build error. Without an i18n prop, the server Trans and IcuTrans use the global instance (the one initReactI18next registered), which is the wrong one with an instance per request: pass that instance as i18n (t is optional). A t alone is not enough, because a t from getFixedT carries no instance. In development and with debug: true they warn about it (GLOBAL_INSTANCE_ON_SERVER) (#​1759, #​1840).
  • fix(Trans): a component given for a self-closing tag (<0/>) with children of its own is no longer remounted on every render. Trans created a new component type for it each time, so its state and effects were reset.
  • fix: warnings are deduplicated per i18next instance instead of once per process, so a second instance reports its own problems. Clones (cloneInstance(), for example one per request in i18next-http-middleware) share their parent's, as they share its logger, so they do not repeat them.
  • fix: a translation load waiting for init() uses i18n.once('initialized') instead of removing its listener with a delay.
  • fix(types): with keySeparator: false and a key prefix (useTranslation(ns, { keyPrefix }), getFixedT), the values of Trans and IcuTrans are typed from the right key. The prefix and the key were joined with the text false (nestedfalsec), so no variables were checked; they are now joined with ., as getFixedT does.
  • fix(types): useSSR takes its third argument { i18n }, and the useTranslation options take bindI18nStore, as at runtime. ErrorCode lists I18N_NOT_INITIALIZED, ICU_TRANS_RENDER_ERROR and GLOBAL_INSTANCE_ON_SERVER.
  • chore: a files whitelist replaces .npmignore; @babel/runtime is no longer a dependency.

v17.1.13

Compare Source

  • fix(types): the react init options keep their types with i18next 27. i18next 27 declares ReactOptions (the type of i18next.init({ react })) as an empty interface and leaves its shape to react-i18next, so with react-i18next 17 the react options were no longer checked and getDefaults().useSuspense did not compile. react-i18next now declares them itself, with exactly the types i18next 26 has: TypeScript accepts the repeated declaration on i18next 26, and on i18next 27 it fills in the empty interface. Nothing changes with i18next 26.

v17.1.12

Compare Source

  • fix(types): type-checking a <Trans> is fast again with large resources. Since 17.0.2 the return type of the key was a type parameter of Trans, so TypeScript also computed it for every key of the namespace: with 50 namespaces of 200 keys, one <Trans> cost about 1.3 million more type instantiations than in 17.0.1, with or without a values prop. The return type is computed inside the values prop again, as in 17.0.1, and values still only needs the variables of the given i18nKey (#​1913). The exported TransProps type loses the Ret parameter added in 17.0.2, so its 6th parameter is the element props E again, as before 17.0.2. Thanks @​leshaduduk (#​1947), fixes #​1946.

Configuration

📅 Schedule: (in timezone Europe/Copenhagen)

  • Branch creation
    • "before 6am on monday"
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate CLI.

This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [react-i18next](https://github.com/i18next/react-i18next) | [`^17.0.9` → `^18.0.0`](https://renovatebot.com/diffs/npm/react-i18next/17.1.11/18.0.1) | ![age](https://developer.mend.io/api/mc/badges/age/npm/react-i18next/18.0.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-i18next/17.1.11/18.0.1?slim=true) | --- ### Release Notes <details> <summary>i18next/react-i18next (react-i18next)</summary> ### [`v18.0.1`](https://github.com/i18next/react-i18next/blob/HEAD/CHANGELOG.md#1801) [Compare Source](https://github.com/i18next/react-i18next/compare/v18.0.0...v18.0.1) - fix(types): declare `@types/react` as an optional peer dependency. The type declarations import from `react`, and with pnpm's global virtual store (`virtualStoreType: global`) TypeScript resolved that to the untyped `react/index.js`, so every React type in them became `any`: wrong props compiled, callback parameters failed with TS7006. Under the default pnpm layout it only worked through pnpm's hidden hoisting. The range is `*`, so projects without TypeScript install nothing extra and an older `@types/react` does not make npm fail ([#&#8203;1948](https://github.com/i18next/react-i18next/issues/1948)) - requires i18next 27.0.1 or later (peer `>= 27.0.1`), which keeps at most 1000 formatters in each cached format ### [`v18.0.0`](https://github.com/i18next/react-i18next/blob/HEAD/CHANGELOG.md#1800) [Compare Source](https://github.com/i18next/react-i18next/compare/v17.1.13...v18.0.0) Released together with i18next 27. The migration guide lists every change with what to do: <https://react.i18next.com/latest/migrating-v17-to-v18> ##### Breaking changes - requires i18next 27 (peer `>= 27.0.0`) and React 18 or later (peer `>= 18.0.0`). React 16 and 17 apps stay on react-i18next 17: on i18next 27, use react-i18next 17.1.13 or later (it brings the types of the `react` init options), or 18. `useSyncExternalStore` comes from React itself, so `use-sync-external-store` is no longer a dependency. - `Trans` output no longer depends on `interpolation.escapeValue`: it always decodes HTML entities after parsing, as `IcuTrans` does, in text and in attribute values, both with `react.unescape` (attribute values used the built-in decoder before). With i18next's default `escapeValue: true`, a value `Tom & Jerry` rendered as `Tom &amp; Jerry` and a date `17/12/2025` as `17&#x2F;12&#x2F;2025`; both now render as written, and so do entities in the translation itself (`&amp;`, `&lt;`, `&nbsp;`, ...). Values still render as text, never as markup (since 17.1.10). The `shouldUnescape` prop and `react.transDefaultProps.shouldUnescape` are ignored and warn (`DEPRECATED_OPTION`, in development and with `debug: true`); remove them. Snapshot tests that contain entities inside `Trans` output need an update ([#&#8203;1903](https://github.com/i18next/react-i18next/issues/1903), [#&#8203;1893](https://github.com/i18next/react-i18next/issues/1893)). - `Trans` and `IcuTrans` re-render on language change by themselves: they subscribe to the `react.bindI18n` (default `languageChanged`) and `react.bindI18nStore` events, like `useTranslation`. Before, they only updated when a parent re-rendered ([#&#8203;1710](https://github.com/i18next/react-i18next/issues/1710)). They still neither load translations nor suspend; with a `t` prop, that `t` still decides the language. `TransWithoutContext` and `IcuTransWithoutContext` stay hook-free. - the `react` options of an instance stay on that instance. `initReactI18next` copied them into module-wide defaults, so a second instance without `react` options inherited, for example, the first one's `useSuspense: false`. Set them on every instance, or call `setDefaults()` once. - the `i18n` returned by `useTranslation` (and passed by `withTranslation` and `Translation`) forwards reads and writes to the instance. It was a copy taken when the language changed, so after `await i18n.changeLanguage('de')` the copy still said `en`, and properties set on it never reached the instance. It is still a new object whenever the language changes, for dependency arrays and the React Compiler. Because the old object now reads the current language too, a check like `prevProps.i18n.language !== this.props.i18n.language` (or the language of a `usePrevious(i18n)`) no longer sees a change: compare the objects (`prevProps.i18n !== this.props.i18n`) or keep the previous language yourself. - `useSSR` and `withSSR` call i18next's `hydrate()` instead of writing `resourceStore.data`, `options.ns`, `initializedStoreOnce`, `isInitialized` and `initializedLanguageOnce` themselves. Same behavior with real instances, including the opt-out for cloned instances. Test mocks of `i18n` used with `useSSR`/`withSSR` now need a `hydrate` method, mocks that load before `init()` need `once`, and mocks used with `Trans` or `IcuTrans` need `on` and `off`, since both subscribe to events now (with `bindI18nStore` set, also `store.on` and `store.off`): a minimal mock like `{ t, options, language }` throws `i18n.on is not a function`. - the `react-i18next/icu.macro` Babel macro (deprecated since 17.0.21) is removed, with the placeholder exports `date`, `time`, `number`, `select`, `plural` and `selectOrdinal`. Write `IcuTrans` directly. - types: the `HTMLAttributes['children']` augmentation for `allowObjectInHTMLChildren` moved to the opt-in `react-i18next/augment-react`. Default installs no longer change React's DOM types. With `allowObjectInHTMLChildren: true`, add `import 'react-i18next/augment-react';` next to your `CustomTypeOptions`; with current `@types/react` it needs `skipLibCheck: true` ([#&#8203;1928](https://github.com/i18next/react-i18next/issues/1928)). - types: `I18nContext` is typed `{ i18n: i18n; defaultNS?: string | string[] } | undefined`, as at runtime: `useContext(I18nContext)` is `undefined` outside an `I18nextProvider`. `getI18n()` keeps its type. - types: react-i18next now declares the `react` init options. i18next 27 keeps an empty `ReactOptions` interface that react-i18next fills in, so `import type { ReactOptions } from 'i18next'` keeps working, and `ReactOptions` is also exported from `react-i18next`. The `defaultTransParent` docs no longer claim a `'div'` default. - the UMD build no longer bundles i18next: it uses the global `i18next` (load i18next's UMD build first) and shrinks from 71.3 KB to 26.2 KB minified. The AMD build (`dist/amd`) is removed; AMD loaders can use the UMD file. - `engines.node` is `>=22`, and the build targets ES2020 syntax with a fixed browser list instead of browserslist `defaults`. ##### Other changes - feat: a `react-server` export condition for `react-i18next`. In a React Server Component, `import { Trans } from 'react-i18next'` failed with `createContext is not a function`; it now resolves to an entry with `Trans` and `IcuTrans` (the variants without React context), `TransWithoutContext`, `IcuTransWithoutContext`, `nodesToString`, `initReactI18next`, `setI18n`/`getI18n` and `setDefaults`/`getDefaults`. Hooks, HOCs, `Translation`, `I18nextProvider` and the SSR helpers stay client-only, so importing them there is a build error. Without an `i18n` prop, the server `Trans` and `IcuTrans` use the global instance (the one `initReactI18next` registered), which is the wrong one with an instance per request: pass that instance as `i18n` (`t` is optional). A `t` alone is not enough, because a `t` from `getFixedT` carries no instance. In development and with `debug: true` they warn about it (`GLOBAL_INSTANCE_ON_SERVER`) ([#&#8203;1759](https://github.com/i18next/react-i18next/issues/1759), [#&#8203;1840](https://github.com/i18next/react-i18next/issues/1840)). - fix(Trans): a component given for a self-closing tag (`<0/>`) with children of its own is no longer remounted on every render. `Trans` created a new component type for it each time, so its state and effects were reset. - fix: warnings are deduplicated per i18next instance instead of once per process, so a second instance reports its own problems. Clones (`cloneInstance()`, for example one per request in i18next-http-middleware) share their parent's, as they share its logger, so they do not repeat them. - fix: a translation load waiting for `init()` uses `i18n.once('initialized')` instead of removing its listener with a delay. - fix(types): with `keySeparator: false` and a key prefix (`useTranslation(ns, { keyPrefix })`, `getFixedT`), the `values` of `Trans` and `IcuTrans` are typed from the right key. The prefix and the key were joined with the text `false` (`nestedfalsec`), so no variables were checked; they are now joined with `.`, as `getFixedT` does. - fix(types): `useSSR` takes its third argument `{ i18n }`, and the `useTranslation` options take `bindI18nStore`, as at runtime. `ErrorCode` lists `I18N_NOT_INITIALIZED`, `ICU_TRANS_RENDER_ERROR` and `GLOBAL_INSTANCE_ON_SERVER`. - chore: a `files` whitelist replaces `.npmignore`; `@babel/runtime` is no longer a dependency. ### [`v17.1.13`](https://github.com/i18next/react-i18next/blob/HEAD/CHANGELOG.md#17113) [Compare Source](https://github.com/i18next/react-i18next/compare/v17.1.12...v17.1.13) - fix(types): the `react` init options keep their types with i18next 27. i18next 27 declares `ReactOptions` (the type of `i18next.init({ react })`) as an empty interface and leaves its shape to react-i18next, so with react-i18next 17 the `react` options were no longer checked and `getDefaults().useSuspense` did not compile. react-i18next now declares them itself, with exactly the types i18next 26 has: TypeScript accepts the repeated declaration on i18next 26, and on i18next 27 it fills in the empty interface. Nothing changes with i18next 26. ### [`v17.1.12`](https://github.com/i18next/react-i18next/blob/HEAD/CHANGELOG.md#17112) [Compare Source](https://github.com/i18next/react-i18next/compare/v17.1.11...v17.1.12) - fix(types): type-checking a `<Trans>` is fast again with large resources. Since 17.0.2 the return type of the key was a type parameter of `Trans`, so TypeScript also computed it for every key of the namespace: with 50 namespaces of 200 keys, one `<Trans>` cost about 1.3 million more type instantiations than in 17.0.1, with or without a `values` prop. The return type is computed inside the `values` prop again, as in 17.0.1, and `values` still only needs the variables of the given `i18nKey` ([#&#8203;1913](https://github.com/i18next/react-i18next/issues/1913)). The exported `TransProps` type loses the `Ret` parameter added in 17.0.2, so its 6th parameter is the element props `E` again, as before 17.0.2. Thanks [@&#8203;leshaduduk](https://github.com/leshaduduk) ([#&#8203;1947](https://github.com/i18next/react-i18next/pull/1947)), fixes [#&#8203;1946](https://github.com/i18next/react-i18next/issues/1946). </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/Copenhagen) - Branch creation - "before 6am on monday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzIuNSIsInVwZGF0ZWRJblZlciI6IjQ0LjEzMi41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJtYWpvciJdfQ==-->
chore(deps): Update dependency react-i18next to v18
All checks were successful
CD Staging / Build & Push journal Image (pull_request) Has been skipped
CD Staging / Build & Push planner Image (pull_request) Has been skipped
CD Staging / Deploy Staging (pull_request) Has been skipped
CD Staging / Deploy PR Preview (pull_request) Has been skipped
renovate/stability-days Updates have met minimum release age requirement
CI / Security Scan (pull_request) Successful in 11s
CI / Dockerfile Package Check (pull_request) Successful in 9s
CI / Visual Tests (pull_request) Successful in 43s
CI / Checks (pull_request) Successful in 2m26s
CI / Journal Image Smoke Test (pull_request) Successful in 2m17s
CI / E2E Tests (pull_request) Successful in 4m8s
Cancel superseded CI / Cancel in-flight CI (pull_request) Successful in 2s
CD Staging / Tear Down PR Preview (pull_request) Successful in 19s
24bf4db273
renovate changed title from chore(deps): Update dependency react-i18next to v18 to chore(deps): Update dependency react-i18next to v18 - autoclosed 2026-11-15 22:05:49 +00:00
renovate closed this pull request 2026-11-15 22:05:49 +00:00
All checks were successful
CD Staging / Build & Push journal Image (pull_request) Has been skipped
CD Staging / Build & Push planner Image (pull_request) Has been skipped
CD Staging / Deploy Staging (pull_request) Has been skipped
CD Staging / Deploy PR Preview (pull_request) Has been skipped
renovate/stability-days Updates have met minimum release age requirement
CI / Security Scan (pull_request) Successful in 11s
Required
Details
CI / Dockerfile Package Check (pull_request) Successful in 9s
Required
Details
CI / Visual Tests (pull_request) Successful in 43s
Required
Details
CI / Checks (pull_request) Successful in 2m26s
Required
Details
CI / Journal Image Smoke Test (pull_request) Successful in 2m17s
Required
Details
CI / E2E Tests (pull_request) Successful in 4m8s
Required
Details
Cancel superseded CI / Cancel in-flight CI (pull_request) Successful in 2s
CD Staging / Tear Down PR Preview (pull_request) Successful in 19s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
trails-cool/trails!332
No description provided.