I'm migrating relatively large java application to React and need to implement internationalisation in React application. Sure, there are many libraries available for i18n in React, like FormaJS and i18next but I found most of them not answering to my requirements:
All the translation is already done in form of java resource bundles where key and messages look like:
simpleKey = Hi! multiParamterKey = Dear {0}, I have {1} messages for you formattingKey = Ticket {0,number,#} has been closed multiLineKey = Dear {0}, \n\ \n\ Have a nice day \n\ otherKey = ...
We don't need pluralisation but want to avoid replacing numeric parameters
{0}
with named parameters{key1}
, if possible, as it could be tricky especially, where format involved (formattingKey). Also I have to use existing keys.The library should support locale for fallback translation. I.e. if I have German locale set as fallback locale and translating key for English, all the missing keys in _en file/source should be translated using _ge file/source
(Ideally) Library should allow changing fallback and current locale dynamically
(Ideally) Library should allow loading bundles using ajax
I decided against FormatJS mostly because of id does not support fallback locales. It has a concept of default translations which should be provided in the component when used.
I close to decide against i18next as - React integration project seems not very popular - Need to change messages to use named parameters
Can anyone recommend some other libraries?