-
Notifications
You must be signed in to change notification settings - Fork 50
Description
Let's say I want to write a requirejs plugin which would be based on i18n but including some more features like :
- Dynamic generation of an array of all supported languages for a given bundle (
[{ code: "en", name: "English", root: true, current: false }, { code: "fr", name: "Français", current: true }, ...]) - ...
Why ? Mainly in order to help providing a language picker (select menu, flags or whatever) in my applications.
Generating the array is easy but knowing which locale part has been detected by the i18n plugin is not currently possible because the value isn't exposed somehow.
In addition to making my life easier, I think appending that functionality to the official i18n requirejs plugin could be useful to other plugin developers too.
Adding something like value._currentLocale = needed.slice(-1)[0] just before onLoad(value) (line 175) does the trick but I'm pretty sure one can find a better solution.
Hopefully my english wasn't too bad and you get the point of this "issue". Thanks.