Closed volmus closed 3 years ago
@bratan ?
@volmus - The currently supported way to load locales is through the bundle.
Yeah and I created a PR to support more ways.
Can you give me an example on how this would be used exactly.
Yea, sure. As you can see in my commit, I analyse the given path to the locale. If the path starts with a slash ("/"), it is an absolute path, which should be resolved by the filesystem. If it does not start with a slash, the path is relative to the application and therefore should be resolved by the rootBundle.
OK, so, the rootBundle is read only. If you want to update your dictionarys, you have to publish a new version of your app. My change allows to download updated dictionarys, place them somewhere on the device and use it beginning with the next app start.
The logic of the rootBundle could change anytime and filtering paths starting with a slash is not a good idea anyways (windows?).
If alternative localization loading is required (ex. retrieving the JSON data from an API, or downloading files as you suggest), an interface can be implemented and everyone could provide their own loader and pass it to the delegate.
Would be super cool to be able to service translation files over the network, like many other translation libraries have. It's a tough process having to release a new update, simply to change a few translations
Hi!
Actually it is not possible to have your locales outside of the rootBundle. This is needed in cases where you download your locales over network and can't have them in the rootBundle.
greetz