Reputation: 101
I want to make react-native app multilingual I use react-native-localization library and i use for JSON formats to store translations. my question is it possible to change JSON strings dynamically for example by adding new language or changing the translation already exist
Upvotes: 1
Views: 2579
Reputation: 598
You can use RN Localization setContent method, after using local strings. Check the docs:
Update / Overwrite Locale
You might have default localized in the build but then download the latest localization strings from a server. Use setContent to overwrite the whole object. NOTE that this will remove all other localizations if used.
strings.setContent({
en:{
how:"How do you want your egg todajsie?",
boiledEgg:"Boiled eggsie",
softBoiledEgg:"Soft-boiled egg",
choice:"How to choose the egg"
}
})
Upvotes: 0
Reputation: 16334
The feature you can use is Code Push here you will be updating the source JS files. if you use a dynamic JSON you will have to request it every time but using codepush you can update the source JSON itself.
More info
https://github.com/Microsoft/code-push/
Upvotes: 1