- Update types to support t function redesign 1615
- requires i18next >= v23.0.1
- optimization for optional lng prop for useTranslation, should now prevent missings when lazy loading translations 1637
- optional lng prop for useTranslation (helping on server side 1637)
- try to fix conditional exports in package.json
- type fix: the type of defaultNS in I18nextProvider should support string[] 1633
- if defaultValue is passed in not ready t functio (via useTranslation) return that instead of the key, even though the user-land could should be fixed 1618
- fix react merged types 1606 originally introduced with #1531 to address #1506
- fix crash in gatsby 1594
- fix fallback of t function in Trans component
- fix crash in gatsby 1594
- fix for node resolution 1589
- context-less version of Trans component to be used for environments without react context 1588
- Update t function types to rely on types coming from i18next 1501
- types: nsMode 1554
- support unescaping forward slash 1548
- fix: reset t when keyPrefix is updated 1544
- types: bindI18n option for UseTranslationOptions
- more html entities to unescape by default 1538
- types: allow iterable with objects as children 1531
- ability to add custom unescape function 1529
- fix: UMD build 1527
- style: explicit React imports 1525
- reset t if ns changes in useTranslation 1518
- Stricter typescript type for Trans components prop 1516
- Add support for keyPrefix in withTranslation 1512
- types: fix Translation component types regression 1511
- types: translation component types 1509
- types: fix missing generic type for HTMLAttributes 1499
- types: fix Trans component to support react 18 types, by introducing allowObjectInHTMLChildren TS option 1492
- types: Added objects explicitly to Trans children 1486
- fix: warn just once 'i18n.languages were undefined or empty' and return true, like before
- types: ReactNode should be prefixed with React 1481
- fix type 'TFunctionResult' is not assignable to type 'ReactNode' on React 18 1480
- update macro to wrap defaults in brackets when necessary 1472
- types: for context prop of Trans component
- fix: transSupportBasicHtmlNodes for keepArray check 1470
- feat: add context prop to Trans component 1464
- types: add nsSeparator to CustomTypeOptions 1471
- fix error for typescript 4.6 1453
- types: fix never return type when using plurals 1453
- types: add values field to Plural component in macros 1446
- types: fix for issue introduced with type extension for react-native 1436
- types: TypeScript interface for the Trans component does now accept react-native props 1418
- add missing types for shouldUnescape and useTranslation 1429
- option to unescape html in Trans 1426
- types: remove undefined from conditional type 1410
- Add type-safe support to deep keyPrefix 1403
- Remove generics from Trans component to suppress warning issue 1400
- Add type support to plurals 1399
- feat(types): add type-safe support to keyPrefix option 1390
- feat(types): allow key separator augmentation 1367
- feature: add key prefix support to useTranslation hook 1371
- typescript: add returnNull and returnEptyString options to TypeOptions interface 1341
- Trans: parse first, then interpolate 1345
- feat(typings): support readonly namespaces in TFuncKey 1340
- feat(types): allow readonly namespaces in useTranslation 1339
- introduce
CustomTypeOptions
type definition and deprecate theResources
type definition 1328
- add transWrapTextNodes option 1324 to prevent a well-known Google Translate issue with React apps 1323, thanks to feross
- typescript/icu macro: add new syntax for interpolation of complex types 1316 -> docs for template usage
- ignore null children in Trans component 1307
- update html-parse-stringify to fix uppercase elements in Trans component 1304
- Replace html-parse-stringify2 with html-parse-stringify 1283 to prevent CVE-2021-23346
- refactor: remove unneeded object 1286
- typescript: Bug fixes 1284
- typescript: Move type definition files 1276
- Fix allow to replace i18n in provider with useTranslation hook 1273
- typescript: Allow
TFuncKey
to be used without specifying the namespace, in the same way TFunction and useTranslation work 1262
- warning for old wait usage
- typescript: Updated TS definitions (adding useSuspense option in TranslationProps) 1247
- typescript: fix: Inference for specific keys ts 4.1 1230
- typescript: Add workaround to suppress infinite instantiation warning 1227
- typescript: withTranslation() typing fix for defaultProps 1226
- typescript: Accept const components prop for Trans 1224
- Fix: Return type inference for t function (typescript 4.1) 1221
- fix: type definitions for typescript 4.1 1220
- fix: typescript definitions for t function without namespaces 1214
- typescript: Make the translation function fully type-safe 1193
- trans should work with misleading overloaded empty elements in components 1206
- fixes passing interpolations options via Trans components tOptions prop 1204
- Avoid redundant re-rendering in I18nextProvider 1174
- Avoid setState while react is rendering 1165
- typescript: fix: typescript definition of context object 1160
- Trans interpolating self-closing tags in components prop(object) 1140
- Trans allow components props to be an object containing named interpolation elements
- providing filename when running babel.parse in icu.macro 1133
- Trans: merge option in mapAST 1120
- Add sideEffects false to package json to allow tree shaking 1097
- fix returning defaultValue for Trans component 1092
- [useTranslation] Avoid setting the new
t
function if the component is unmounted. (1051)[i18next#1051]
- fixes copying ns in useSSR
- typescript: Add optional defaultN 1050
- typescript: Translation component's ready parameter is missing in TypeScript definition 1044
- change hook condition in Trans to equal useTranslations implementation
- useSSR: add namespaces to init options options.ns 1031
- typescript: Fix the type of the components props of Trans 1036
- typescript: Allow ComponentType for Trans'
parent
type 1021
- typescript: Allow html props on Trans, fix
parent
prop type 1019
- handle array fallback on wrongly configured app ;) 1010
- typescript: Extend withTranslation tests to include optional props 1009
- Store should be initialized after useSSR 1008
- Only pass forwardedRef to children if options.withRef is false 999
- remove used jsx in withTranslation to avoid issues while compiling 994
- withTranslation allow not only passing a ref with option withRef but also passing a forwardedRef from outside as props (before forwardedRef was only added to wrapped component if the withRef option was set) 992
- Update
rollup.config.js
for IE11 Transpilations 988
- typescript: Use updated ts export default from i18next 984
- Breaking based on i18next changes made in v18.0.0 changing the language should not trigger a Suspense anylonger. The state will be ready and
t
bound to the previous language untillanguageChanged
get triggered -> this results in a nicer experience for users (no flickering Suspense while changing the language). Based on issue "Suspence is fired during lang change when useTranslation called in between" 975 - the default bindI18n is now
languageChanged
andlanguageChanging
was removed from that default - Adding
languageChanging
to bindI18n will bring back old behaviour where a language change will trigger a Suspense / ready: false while loading those new translations - You can now override the defaults in i18next.options.react for
bindI18n
,bindI18nStore
anduseSuspense
in the hook byuseTranslation(ns, { bindI18n, bindI18nStore, useSuspense})
or in the HOC by passing those as props.
- avoid conditional hook call in edge case (was only issue in wrong setup useContext outside I18nextProvider) 951
- also use count from
values
object passed to Trans if passed - else use the one on props 947
- ICU: Fixes macro to support count prop and expressions better 939
- avoid conditional hook call in edge case (wrong setup) 935
- Trans: do not replace html tags in translation strings that are not in the transKeepBasicHtmlNodesFor array 919
- Set ready flag to false when i18n instance has not been initialised 918
- fix / extend icu.macro: ICU: Trans macro will parse defaults as alternate to children 917
- typescript: fix types for use() 912
- assert edge case trans component get set a key
- assert context get destructed of empty object if context gets used falsely on a component got pulled out of main tree from react-portal or similar
- only apply initial values in useSSR, withSSR on i18next instances not being a clone (eg. created by express middleware on server) ==> don't apply on serverside
- Reload translations whenever namespaces passed to useTranslation() change 878
- fixes a regression in Trans component taking namespace from passed t function 867
- Restore support passing the defaultNS via I18nextProvider prop 860
- HOC: expose wrapped component as WrappedComponent property 853
- Fix useEffect mount/unmount usage 852
- trigger suspense on languageChanging by add listening to that event too (new in [email protected]) - if you do not like this behaviour of suspending during languageChange - remove it from bindI18n
- expose context 829
- Support taking values for interpolation not only from content but the props count, values too: Replace count prop from in translation string automatically 826
- brings back nsMode=default|fallback 822
- typescript: Add missing type definition for withTranslation options 821
- Fix Trans component ignore default options 818
- useTranslation useEffect also guard against unmounted for bound events...seems unmount and actual call to useEffect cleanup are not in correct order (component is first unmounted and then unbound - should be vice versa)
- use forwardRef for withTranslation 802
- fixes Translation reset after component is unmounted with useTranslation 801
- Fix the displayName of HOC components 798
- fixes: transSupportBasicHtmlNodes doesn't work with self-closing Trans 790
- ReferenceError: setImmediate is not defined 787
- Adding support for nested component inside Trans that are a list.map like
<ul>{['a', 'b'].map(item => ( <li key={item}>{item}</li> ))}</ul>
784 (Adding<ul i18nIsDynamicList>
will also create correct missing string)
- typescript: updated typescript definition of the UseTranslationOptions interface, added the useSuspense configuration property 778
- allow p in Trans
- allow br, strong, i tags be used for translations handled by Trans
- IE11 sending console as the first argument to apply 774
- Allow to enable/disable useSuspense at a hook or component level 769
- typescript: Add ready/tReady type definitions 753
- fix cimode won't load therefore won't be ready 768
- Add bindI18nStore event options to listen to store changes if needed 749
- allow passing ready if i18next not initialized yet but initialStore set (timing issue in razzle)
- forward ready state in withTranslation, Translation
- better naming for Wrappers in HOC for easier use of react debugger in console
- allow setting options react.useSuspense to false on i18next.init to avoid usage of suspense
- fixes namespace loading for false inital state undefined
- typescript: Make children optional within TransProps 728
- try avoiding pull in of regenerator runtime for async usage -> use Promise for now
- fix initial props on withSSR
- refactor ready state in useTranslation
- allow object spread
const { t } = useTranslation()
714 - typescript: add types for I18nextProvider 721
- released to npm
- for MIGRATION READ https://react.i18next.com/latest/migrating-v9-to-v10
- hooks: make reportNS bound to the i18n instance - so report is per request 711
- hooks: add Translation render prop 708
- hooks: add I18nextProvider for passing i18n instance via context
- hooks: might fix infinit loop issue on undefined language (set ready to true anyway) 673
- hooks: initial alpha version with all build targets -> preparing v10 release
- typescript: Add TS definition for reportNS prop 699
- typescript: fix: useTranslation hooks typing 698
- typescript: TFunction usage inside NamespacesConsumer should behave 694
- fixing react-i18next throwing webpack error when initializeing using @babel/runtime 7.3.0 685
- updated all deps
- UMD: Environment optimization with rollup-plugin-replace support 683
- typescript: add generic type to t function and the tests 665
- hooks: enable passing in i18n to useTranslation hook so we could wrap that with a useContext enabled hook
- fix useSSR for hooks storing state on i18n instance and not globally 671
- should fix case where fallbackLng is set false and invalid lng is loaded in hooks -> never ready 677
- multiple typescript improvements
- fix hooks ts 658
- fix ts 655
- allow defining
transEmptyNodeValue
in i18next.options.react to set a default fallback value for empty nodes to allow i18next fallback flow 462 - Warn if i18next instance is a promise 652
- keeping legacy names (no deprecation on them as this will be last version using those -> v10 will be based on hooks)
BREAKING
- out of licensing reasons the ponyfill for react-context had to be removed 635
Using react >= 16.3.0 will be save - in other cases you will need to polyfill react.createContext yourself!!
- update typescript definitions for i18next v13 631
- try fixing hooks ready algorithm 642
- try fixing edge case of unset state: 615
- handle initial SSR props only once
- remove componentWillReceiveProps call in I18nextProvider to comply with react strict mode 596
- rename named export to window.ReactI18next for standalone js
- try fixing standalone browser build
- remove wait option in hooks code (not used anylonger)
- use react suspense in hooks experimental code learn more
- make export in ./hooks.js explicit
- Ensure withI18n hoists static members. 584
- comes with support for hooks that are experimental in react v16.7.0-alpha learn more
- publish changes to typescript definitions 567
- persisting generated i18nOptions on withI18n hoc to avoid rerenders on pure components
- add typedefinitions 557
- add innerRefs support to withContext, withI18n
- replaces getWrappedInstance on withNamespaces / translate with passing a innerRef facebook/react#13456 534
- fix SSR cases
- fix issue with context not applied when merging i18n options
- add prop-types to peer deps as long we use the ponyfill create-react-context
- remove prop-types in tests
- remove proptypes dependency - not needed anylonger as we do not define old context
- move out ssr stuff to utils
- move reportNS to the NamespacesConsumer
- use @babel/plugin-transform-runtime
-
translate HOC was renamed to "withNamespaces" as it controls which namespaces should be loaded
-
I18n render prop was renamed to "NamespacesConsumer" as it controls which namespaces should be "consumed"
-
there is a new context.consuming HOC "withI18n" adds i18n, t to component props (without the extra options of withNamespaces)
-
there is a simplification for interpolation in translations
'Hello <1><0>{{name}}</0></1>, you have <3>{{count}}</3> message. Open <5>hear</5>.'
can be written as:
'Hello <1>{{name}}</1>, you have {{count}} message. Open <5>hear</5>.'
=> there is no need to add <0>...</0>
around interpolated values anylonger
=> your old files having those extra pseudo tags will still work without needing to change them
- there is a new I18nContext -> I18nContext.provider, I18next.consumer using new react context api
Using react's new context api
should be non breaking in most cases, with following exceptions:
- using preact you will have to use preact.createContext plugin (or eventual hope the provided polyfill works for preact too)
- you used the translate.getWrappedInstance function -> you will need to use instance.getWrappedInstance().getWrappedInstance() now as the translate hoc is now wrapped in an additional I18nContext.Consumer
still we prefer to increase this to a major version as beside the described egde cases there might be other effects we not have covered with our tests
- Load missing namespaces when updating ns prop on I18n component 523
- pass down lng via props in I18n and translate HOC - for use cases like 508
- fix related to issue #504: also report default Namespace with translate() 506
- Added reportNS function to I18NextProvider to report used namespaces 500
- fix small issue in icu.macro introduced on refactoring
- Adds import { Trans, Plural, Select } from
react-i18next/icu.macro
a babel macro to allow nicer components used with ICU format (which as default would result in invalid JSX). discussion
- Skip custom html tags in Trans component translation PR482
- i18n in context is optional as it can be passed via props too 474
- avoid rerenders triggered by bound i18next events while I18n or translate hoc are not ready yet (omitBoundRerender: true --- is default) 456
- Allow Trans component to be used with props only for icu use case (next step babel makro) 439
- Allow to pass a function as parent for component PR424
- adds tOptions to Trans component to support ICU
- removes componentWillMount lifecycle method from I18n.js render props as it will get deprecated on react 16.3 404
- Fix reference to props in constructor PR411
- passes down tReady from translate hoc for cases you prefer showing a placeholder instead of default return null in case of wait: true and not yet loaded translations PR400
- I18n render prop calls with ready as third param
- enables setting prop
ns
on Trans component to override namespace passed by render prop or hoc - allows trans component with no children just returning the string getting from translations
- reorder selection of i18n in I18n render prop
- reorder selection of i18n in I18n render prop
- more save access to options in general
- more save access to options.react
- replace Interpolate PureComponent with Component to assert it gets rerendered on lng change
- remove react-dom from peer dependencies as module is used in react-native too
- Allow translate HOC to take a function for getting namespaces 372
- fixes: bring back Trans component t fc from context
- optional take i18n.t in Trans component if non t function passed in via props or context
- fixes rendering in Trans component in case of no parent
- working Trans component without the need of setting options.react
- [BREAKING] As with react 16 you can return multiple elements from render - based on that we do not need to return a wrapper any longer from Trans component.
Starting with v7.0.0 Trans component per default won't add a parent div around content passed as children. It will just return it's children.
You still got the option to set a parent if you prefer content being wrapped.
If you prefer wrapping for all your Trans components (or for backwards compatibility) you can set option react.defaultTransParent
to an element on i18next init.
- adds hashTransKey function for custom key generation in case of not passing a key to Trans component and not like having the source value as key
- pre-check namespaces to avoid unnecessary initial
null
render PR336
- remove PureComponent from Trans
- fixes support passing i18n and t to Trans as props PR315
- fixes translate hoc build
- stop using PureComponent and use Component again...seems we get an issue with react-router v4 if using PureComponents
- recreate t function on i18next updates so PureComponents relying on t get an update triggered
- rebuild needed cause of uppercasing for components name was not reflected in last build
- remove react from dependencies - not sure how that came into the package.json
- [BREAKING] removes options to set translateFuncName in translate hoc (was not supported in Trans and Interpolate component anyway)
- setting i18n instance and defaults can now be done by i18next.use(reactI18nextModule) making I18nextProvider obsolete
- As an alternative to the translate hoc you now can use the I18n component supporting a render props (for details about render props https://www.youtube.com/watch?v=BcVAq3YFiuc)
- fixes AST implementation for preact
- replaces regex used to parse nodes from string to an ast implementation solving #298
- Pass extra parameters to Trans parent component
- adds module export in package.json pointing to es dist files.
- you now can set i18n instance on translate hoc once using setI18n:
import translate from 'react-i18next';
import i18n from './i18n';
translate.setI18n(i18n);
- [BREAKING] we no longer accept wait to be specified on i18next init options like
{ wait: true }
-> all overrides for the translate hoc now have to be in childreact
like{ react: { wait: true } }
- you now can override all the default options for translate hoc by setting them on i18next.init (excluding
translateFuncName
as we need that upfront to define childContextTypes)
i18next.init({
// ... other options
react: {
wait: false,
withRef: false,
bindI18n: 'languageChanged loaded',
bindStore: 'added removed',
nsMode: 'default'
}
});
- you now can override all defaults for translate hoc options (including
translateFuncName
) by using:
import translate from 'react-i18next';
translate.setDefaults({
wait: false,
withRef: false,
bindI18n: 'languageChanged loaded',
bindStore: 'added removed',
nsMode: 'default',
translateFuncName: 't'
});
- make trans component work with preact and preact-compat
- add preact example
- Trans component parent element configurable PR278
- optimize generated defaultValue for components not having children
- move react, prop-types, ... to peerDependency again
- optimize trans component output
- fixes issue in changeLanguage on set via translate hoc ssr
- allow passing initialI18nStore and initialLanguage to I18nextProvider via props to support simpler ssr
- adds a serverside rendering sample based on razzle
- pass i18n instance to context inside translate hoc to simplify usage in nextjs
- options.react.exposeNamespace will expose namespace on data-i18next-options for consuming in editors
- introduces Trans component which enables you to translate nested components incl. interpolation by resulting in one translatable string. learn more
- allow passing down initialI18nStore and initialLanguage to translate hoc to support ssr scenario better see example/nextjs
- allow passing i18next instance in translate hoc options makes integration in nextjs easier
- Remove workaround to set ready if there was no initialized signal PR263
- Fix react-i18next to work with TypeScript PR261
- eslint cleanup
- a lot more tests
- flag nsMode: 'fallback' -> uses namespaces passed to translate hoc as fallbacks #254
- deploys 3.1.1 as possible breaking: fixes issue in fixing t function - pass only first namespace not an array of namespaces (access other namespaces like: this.props.t('namespace:key'))
- reverts last change
- fixes issue in fixing t function - pass only first namespace not an array of namespaces
- fixes wrong warning of missing prop on interpolate with format
- the wait flag on translate hoc can now be set globally on i18next options
i18next.init({ wait: true })
- [BREAKING] assert you install prop-types as a peerDependency based on changes in react >= 15.5.x
- update react to 15.5.x use prop-types module to remove react warnings PR248
- update all dependencies
- move react, prop-types to peerDependencies
- try not access store if undefined for hmr
- fixes validation for missing prop in interpolate component
- support formatting inside interpolate component
- tanslate hoc: expose the i18n instance via props
- translate hoc wait option asserts now that i18next is initialized before rendering (waits for lng detection)
- [BREAKING] needs i18next >= 4.2.0
- pass style prop to interpolate component
- define i18next as a peerDependency
- Suppresses required context type warning if passing i18n as a prop PR205
- allow passing i18next instance via props to translate hoc PR203
- adds options bindI18n, bindStore can be set to false or string of events to bind for triggering updates
- allows to set a className on interpolate component
- update all dependencies and devDependencies
- add option to change t function name to something else PR196
- Added an option of using the with a raw HTML PR195
- only trigger loaded namespaces if mounted
- update for react 15.2, eliminates Unknown Prop Warning
- Added conditional warning on unmatched variable during interpolation [PR 160](i18next#160
- Hoist non react statics [PR 150](i18next#150
- Handle i18next added and removed resource events [PR 150](i18next#150
- move ns loading to did mount
- possible fix for HRM issues
- adds wait option, which delays initial rendering until translations are loaded
- possible fix for HRM issues
- change global name
- adds getWrappedInstance() to translate wrapper
- Support for universal apps / server-side rendering PR 52
- fixes bower json - bower publish only
- change build to rollup
- added WrappedComponent property to translate wrapper PR 15
- fixing export of index
- change package.json main to
/lib/index.js
- move build from gulp to npm run script