redux-react-i18n | An i18n solution for React/Redux and React Native projects | Internationalization library
kandi X-RAY | redux-react-i18n Summary
kandi X-RAY | redux-react-i18n Summary
An i18n solution for React/Redux and React Native projects
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of redux-react-i18n
redux-react-i18n Key Features
redux-react-i18n Examples and Code Snippets
Community Discussions
Trending Discussions on redux-react-i18n
QUESTION
I am in the middle of (large)app rewrite into Reactjs-redux and internalization is next problem.
Ive been looking at some currently available libraries (redux-react-i18n , 18n-react) but none of them seems to fit.
Why ? Because my localized strings are stored in separate .properties
files and this cannot be changed. But there is a possibility generate whatever format from this in compile time
Example en_US.properties:
- key1=This is a constant string
- key2=This is a string with {parameter}
- ....
and similar with de_de.properties file and so on
Also language can be change only on page refresh so this is making it little bit easier
My question is how to approach this problem. My first naive approach is generate some static constant js object available in app globaly but im feeling thats against javascript best practises also no idea how to deal with parametrized strings
As im fairly new to javascript id like to hear any ideas
...ANSWER
Answered 2018-May-09 at 07:43In case somebody has same problem I ended up writing script converting .properties files into json files
Then in React code i created HOC component wich gets keys(or namespaces depends on how you organize your json files) as parameter and fetches values from server These keys are usually for whole page but sometimes also for single component if it makes sense All it takes is one more HTTP request you can also cache result
Hop it helps
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install redux-react-i18n
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page