react-i18next को 17.x से 18.x पर अपग्रेड करना
react-i18next 17.1.13 और 18.0.0 के सार्वजनिक API की तुलना, उनके TypeScript टाइप से अपने-आप निकाली गई। बदला हुआ सिग्नेचर संभावित असंगत बदलाव है, निश्चितता नहीं।
सारांश
| हटाए गए इम्पोर्ट पाथ | 0 |
|---|---|
| हटाए गए एक्सपोर्ट | 0 |
| बदले गए सिग्नेचर | 5 |
| क्लास या इंटरफ़ेस के हटाए गए सदस्य | 0 |
| क्लास या इंटरफ़ेस के बदले गए सदस्य | 0 |
| नए डिप्रिकेटेड | 1 |
| आवश्यकताओं में बदलाव (engines, peer निर्भरताएँ) | 3 |
| नए एक्सपोर्ट | 1 |
हटाए गए एक्सपोर्ट
कुछ नहीं मिला।
बदले गए सिग्नेचर
| export | पहले | बाद में |
|---|---|---|
react-i18next · useSSR | (initialI18nStore: Resource, initialLanguage: string): void | (initialI18nStore: Resource, initialLanguage: string, props?: { i18n?: any; } | undefined): void |
react-i18next · ErrorCode | "NO_I18NEXT_INSTANCE" | "NO_LANGUAGES" | "DEPRECATED_OPTION" | "TRANS_NULL_VALUE" | "TRANS_INVALID_OBJ" | "TRANS_INVALID_VAR" | "TRANS_INVALID_COMPONENTS" | "USE_T_BEFORE_READY" | "SUSPENDED_WHILE_LOADING" | "NO_I18NEXT_INSTANCE" | "NO_LANGUAGES" | "DEPRECATED_OPTION" | "TRANS_NULL_VALUE" | "TRANS_INVALID_OBJ" | "TRANS_INVALID_VAR" | "TRANS_INVALID_COMPONENTS" | "USE_T_BEFORE_READY" | "SUSPENDED_WHILE_LOADING" | "I18N_NOT_INITIALIZED" | "ICU_TRANS_RENDER_ERROR" | "GLOBAL_INSTANCE_ON_SERVER" |
react-i18next · I18nContext | React.Context<{ i18n: i18n; }> | React.Context<{ i18n: i18n; defaultNS?: string | string[] | undefined; } | undefined> |
react-i18next · useTranslation | <const Ns extends FlatNamespace | $Tuple<FlatNamespace> | undefined = undefined, const KPrefix extends KeyPrefix<FallbackNs<Ns>> = undefined>(ns?: Ns | undefined, options?: UseTranslationOptions<KPrefix> | undefined): UseTranslationResponse<FallbackNs<Ns>, KPrefix> | UseTranslationSelector | UseTranslationLegacy |
react-i18next · UseTranslationOptions | { i18n?: any; useSuspense?: boolean | undefined; keyPrefix?: KPrefix | undefined; bindI18n?: string | false | undefined; nsMode?: "fallback" | "default" | undefined; lng?: string | undefined; } | { i18n?: any; useSuspense?: boolean | undefined; keyPrefix?: KPrefix | undefined; bindI18n?: string | false | undefined; bindI18nStore?: string | false | undefined; nsMode?: "fallback" | "default" | undefined; lng?: string | undefined; } |
क्लास या इंटरफ़ेस के हटाए गए सदस्य
कुछ नहीं मिला।
क्लास या इंटरफ़ेस के बदले गए सदस्य
कुछ नहीं मिला।
नए डिप्रिकेटेड
| export | @deprecated |
|---|---|
react-i18next · TransSelectorProps.shouldUnescape | ignored: Trans always decodes HTML entities |
आवश्यकताओं में बदलाव (engines, peer निर्भरताएँ)
| पहले | बाद में | |
|---|---|---|
engines.node | — | >=22 |
peerDependencies.react | >= 16.8.0 | >= 18.0.0 |
peerDependencies.i18next | >= 26.2.0 | >= 27.0.0 |
नए एक्सपोर्ट (1)
| import | export | kind |
|---|---|---|
react-i18next | ReactOptions | variable |
इन संस्करणों के बीच का changelog
पैकेज के लेखकों द्वारा प्रकाशित पाठ, जैसा है वैसा दिखाया गया।
18.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 & 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](https://github.com/i18next/react-i18next/issues/1903), [#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 ([#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`,अपने AI एजेंट को ये तथ्य दें
Vigia एक मुफ़्त MCP सर्वर है: आपका कोडिंग एजेंट कोड लिखने से पहले वर्ज़न, ब्रेकिंग बदलाव और कमज़ोरियाँ जाँचता है। न साइनअप, न API कुंजी।
claude mcp add --transport http vigia https://vigia.coredls.cloud/mcp
Cursor में जोड़ेंVS Code में जोड़ें★ GitHub पर स्टार दें
कोई भी दूसरा MCP क्लाइंट
{ "mcpServers": { "vigia": { "url": "https://vigia.coredls.cloud/mcp" } } }एजेंट स्किल (SKILL.md): एजेंट को बताती है कि Vigia कब इस्तेमाल करना है · पुल रिक्वेस्ट के लिए GitHub Action
अक्सर पूछे जाने वाले प्रश्न
react-i18next को 17 से 18 पर अपग्रेड करने पर कौन-से असंगत बदलाव हैं?
react-i18next 17.1.13 और 18.0.0 के बीच Vigia को 0 हटाए गए एक्सपोर्ट, 5 बदले गए सिग्नेचर और 0 हटाए या बदले गए क्लास/इंटरफ़ेस सदस्य मिले।
react-i18next 18 में क्या डिप्रिकेट हुआ?
react-i18next 18.0.0 में 1 एक्सपोर्ट या सदस्य नए रूप से डिप्रिकेटेड चिह्नित हैं।
एजेंटों के लिए
GET https://vigia.coredls.cloud/v1/packages/npm/react-i18next/upgrade?from=17.1.13&to=18.0.0