Compare Versions - i18next
npm / i18next / Compare Versions
25.10.9
- feat(types): export
SelectorParam<Ns, KPrefix>helper type — a stable, readable alternative toParameters<TFunction<Ns>>[0]for typing selector function props 2414
25.10.8
- fix(types): reorder
TFunctionSelectoroverloads soParameters<TFunction>resolves to the general selector signature instead of the brandedSelectorKeytype 2412
25.10.7
- feat(types): support typescript 6 to address https://github.com/i18next/react-i18next/issues/1910
25.10.5
- feat(types): selector functions as
keyPrefixingetFixedTnow provide full type-safe key narrowing — the returnedtfunction is scoped to the prefix subtree 2367
- check also for I18NEXT_NO_SUPPORT_NOTICE env variable
- feat(types):
keyFromSelectoris now type-safe — the selector callback is constrained against your resource definitions, catching invalid keys at compile time. Supports optionalnsandkeyPrefixoptions for non-default namespace/prefix contexts 2364
- fix(types):
FilterKeysnow correctly excludes base keys that have context variants when the provided context doesn't match any of them (e.g. keysomewith variantsome_meis no longer accessible withcontext="one")
- feat(types):
keyFromSelectornow returns a brandedSelectorKeytype thatt()accepts directly, enabling pre-computed and reusable translation keys 2364 - feat: support selector syntax for
keyPrefixingetFixedTand per-call options 2367 - feat(types): interpolation values are now automatically typed based on built-in format specifiers —
{{val, number}}requiresnumber,{{val, datetime}}requiresDate,{{name}}requiresstring, etc. Custom formatters can be typed viainterpolationFormatTypeMapinCustomTypeOptions2378 - fix(types):
FilterKeysin selector mode now preserves non-context, non-plural leaf keys whencontextis provided, fixing incorrect type narrowing when combiningreturnObjects: truewithcontext2398
-
- fix:
getFixedT()selector now resolves namespaces against the effectivensrather than the global init options #2406
- fix:
- fix: selector API namespace resolution regression for single-string
nsand primary namespace in array #2405. Reverts the broad namespace-prefix rewrite from v25.8.15 and replaces it with a targeted fix that only rewrites paths starting with a secondary namespace in a multi-namespace array, matching the type-level contract ofGetSource
- update deps
- fix(types):
on()method now correctly returnsthisinstead ofvoid, matching the runtime behavior and enabling proper method chaining in TypeScript
- fix: getCleanedCode now replaces all underscores
- improve support notice shown logic
- improve support notice shown logic
- type definitions for new transDefaultProps option in react-i18next react-i18next: #1895
- Enhance
cloneInstanceto create a new interpolator if interpolation options are passed in. This will address 2371.
- types: export
InterpolationMap
-
feat:
exists()method now respectsreturnObjectsoption - returnsfalsewhen accessing an object key withreturnObjects: false, enabling detection of object vs string keys 2359Note: This is a potential behavior change. If you were previously calling
exists()withreturnObjects: falseon object keys, those calls will now returnfalseinstead oftrue. This enables developers to detect whether a key points to an object or string value.
- fix last change => for cjs there is just 1 default export, no named exports, fixes 2348
- add new selector API to improve TypeScript IDE performance 2322
- To enable it, set
enableSelector: truein your configuration options - With
enableSelector: "optimize", i18next can now handle translation dictionaries of any size, without affecting IDE performance or build times - To assist with the migration, we've published the following packages:
- To enable it, set
- remove unnecessary debug logs
- warn if legacy
interpolation.formatfunction is still used
- fix options type for
parseMissingKeyHandler
- optimize
changeLanguageto correctly usegetBestMatchFromCodes(string or array) 2299 and improveresolvedLanguageset for non canonical codes
This is a potentially breaking release:
- fix: Interpolation fails with arrays (TypeError) and doesn't work with objects in defaultValue 1829
- optimize fix: Bug Report: Unsafe Behavior in i18n.t Function Leading to Potential Code Execution 2273
- if no Intl api, log error and use dummy rule
- early return and log error, if no Intl api
This is a major breaking release:
- remove support for older environments
- remove old i18next JSON formats
- To convert your existing v3 translations to the v4 format, have a look at i18next-v4-format-converter or this web tool.
- remove support for compatibility to v1 API
- Intl API is mandatory now and will not fallback anymore
- possible compatibility layer for older formats:
test/compatibility/v4/v4Compatibility.js - rename
initImmediatetoinitAsync - fallback to
devlanguage if plural rule not found - remove TypeScript v4 support. TypeScript v5 is now an optional peer dependency
- addresses
➡️ check out the migration guide
- fix utils imports for Deno
- use
Intl.getCanonicalLocalesfunction if available to format language code, like suggested in 2244
- types(TFunction): make return not inferrable and use defaultValue as return when provided 2234
- If backend errors with retry flag, set internal state to 0, so reloadingResources should work 147
- optimize getBestMatchFromCodes for https://github.com/i18next/i18next-browser-languageDetector/issues/281
- optimize: consistent _zero special handling also for defaultValue_zero 2124
- intl plural rule for dev is now en (consistent with v3 compatibility)
- fix: Use Typescript 5 types with Typescript 5+ 2108
- Hint: If you're using TypeScript 4 and you navigate to the type definitions in your code editor, it might be you will see the TypeScript 5 types, but the TS compiler should use the correct types.
- types: fix types for array access
- types: fix for older ts version (context validation only for TS 5)
- types: fix FormatFunction should allow any value inside options parameter
- prevent cosmetic SyntaxError because of non catched error variable
- optimize TypeScript V4 export
- types: CustomInstanceExtenstions
- fix types export for TypeScript v4 in combination with react-i18next
- fix for TypeScript v4 in combination with react-i18next
- fix: consider importing '*.js'
- types: optimize mts
- fix some mjs typings
- types: use unknown to better infer types on nested t functions also for older typescript version 2032
- fix: preload languages also on cimode, if configured also as fallbackLng
- fix: preload languages also on cimode, if configured
- preload languages also on cimode, if configured
- pass correct language for custom i18nFormat
- types: named export for FlatNamespace
- types: export some types for next-i18next
- types: fix typescript imports
- types: Add brand to TFunction type so different namespaces' TFunctions are not treated as compatible 1994
- types for hasLoadedNamespace
- fix utils import (for Deno)
- cloneInstance: introduce
forkResourceStore1974 - types: default argument values for ParseKeys type
- types: export ParseKeys
This is a major breaking release:
-
redesigned TypeScript types 1911 (use TypeScript v5)
-
removed
setDebugfunction in the logger: 1954 -
changed
returnNulldefault tofalse1885 -
drop support for old browsers and Node.js < v12 1948
-
ordinal plural keys are now prefixed with
_ordinalto help translators (non-breaking, bacause of fallback) 1945
➡️ check out the migration guide
- extend hasLoadedNamespace function options to pass optional lng to optimize server side usage of react-i18next
- fix: nested interpolation with data model "replace"
- fix: interpolation with data model "replace"
- types: missing dir function export for typescript
- types: allow als general options as second argument for t function
- types: t function overloads fix (open issue is still calling t with optional options argument)
- types: t function overloads for call with ns option in combination with objects
- types: more t function overloads for call with options argument but without ns value
- types: more overloads for t function
- offer possibility to define a language detector's detect function as promise
- types: ability to pass ns as option instead of prefix i.e.
i18next.t('bar', { ns: 'alternate' });
- dir function executible also without initialization
- named export for dir function
- revert: guess if languageDetector is async if no info provided
- guess if languageDetector is async if no info provided
- extend backend connector to accept also backends with promise / async-await signature
- fix CallbackError type
- Make the translation function fully type-safe 1775
BREAKING: Since this is a major rewrite for TypeScript usage we decided to create a major version. For JavaScript users v22.0.0 is equivalent to 21.10.0
- defaultNS can now also be set to false
- fix: make sure retry logic ends for failed backend reads
- allow overriding keyPrefix option t function returned from getFixedT (does not work for normal t function)
- types: new optional unescape option for react-i18next
- fix: respect pluralSeparator for special _zero handling
- types: fix loaded event result
- fix: loadNamespaces() doesn't keep resolving order when the second request completes before the first one 1785
- fix: regression introduced in v21.6.11, respect
appendNamespaceToMissingKeyforparseMissingKeyHandler1507
- fix: interpolation with $ in values resets nextIndex to wrong position with skipOnVariables 1782
- types: keyPrefix in react options
- fix hasLoadedNamespace when providing inmemory resources and a backend but partialBundledLanguages is not set
- fix formatter for false inline options
- make sure resolvedLanguage is set if lazy loading resources
- make sure key and additionally optional defaultValue are passed to parseMissingKeyHandler function 1445
- fix: respect skipOnVariables option passed in t function also for $t() usage
- fix: respect skipOnVariables option passed in t function
- fix: consistently lowercase new formatter names internally
- types: wait option does not exist anymore for react-i18next
- remove console.log statement
- include version info in generated package.json of esm dist
- do not use options.interpolation reference
- add package.json to exports subpath
- rtl fix for -arab language codes
- bind all i18next functions to this, this way you can for example just use t() instead of i18n.t() 1682
- adds support for formats provided by Intl API (number, currency, datetime, relativedate, list)
- optimize do skip natural language detection also if user provided nsSeparator option is passed via direct options
- optimize Intl api check
- fix Intl.PluralRules fallback
- log error if Intl.PluralRules API is not available
- A new RTL support added for
ckblanguage code
- fix defaultNS regression if translation namespace is defined in ns option, fixes #1658
- fix typescript typo for skipOnVariables
This is a major breaking release:
- introduce new v4 json format (intl plural forms with ordinal support), simplifyPluralSuffix not used anymore
skipOnVariablesby default now is true- automatically detect natural language keys (no need to set nsSeparator or keySeparator to false)
- remove deprecated whitelist features
- introduce new i18next.resolvedLanguage property
➡️ check out the migration guide