Skip to content

fix(deps): update dependency react-i18next to v18 - #2098

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/react-i18next-18.x
Open

renovate[bot] wants to merge 1 commit into
mainfrom
renovate/react-i18next-18.x

Conversation

@renovate

@renovate renovate Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
react-i18next 17.1.13 → 18.0.2 age confidence

Release Notes

i18next/react-i18next (react-i18next)

v18.0.2

Compare Source

  • fix: useTranslation, Trans and IcuTrans re-render for a bindI18nStore event that fires after they rendered but before they subscribed (a bundle added in a parent's layout effect, for example). They kept the old text, because only the events their own subscription received changed their snapshot (#​1949)

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.

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • 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 was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added the renovate label Nov 10, 2026
@renovate

renovate Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: package-lock.json
npm warn Unknown env config "store". This will error in a future major version of npm. See `npm help npmrc` for supported config options.
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: @terrestris/shogun-admin@18.1.4
npm error Found: i18next@26.7.2
npm error node_modules/i18next
npm error   i18next@"26.7.2" from the root project
npm error
npm error Could not resolve dependency:
npm error peer i18next@">= 27.0.1" from react-i18next@18.0.2
npm error node_modules/react-i18next
npm error   react-i18next@"18.0.2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry this command with --force or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /runner/cache/others/npm/_logs/2026-11-19T18_45_41_662Z-eresolve-report.txt
npm error A complete log of this run can be found in: /runner/cache/others/npm/_logs/2026-11-19T18_45_41_662Z-debug-0.log

@renovate
renovate Bot force-pushed the renovate/react-i18next-18.x branch 3 times, most recently from feb523b to e2fefa1 Compare November 17, 2026 00:58
@renovate
renovate Bot force-pushed the renovate/react-i18next-18.x branch from e2fefa1 to 1ac8137 Compare November 19, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants