Closed devmondo closed 9 years ago
i solved the bundling issue, by using jspm json plugin, so simply i define translation in json file and then instead of default way of loading resources, i use i18next to initialize like this
this.localizer.init({ lng: "en-US", resStore: {} });
this will prevent it from downloading any resource, then in each view i just add required translation like this
this.i18next.addResourceBundle("en-US","translation",myJSONFile)
so now this somehow emulates asp.net per page localization.
hope that helps :)
lol ok from your issues title I thought the exactly opposite that you wanted to bundle them all up and load them in advance, so eager load them, but you seem to be after lazy loading per feature/bundle. Anyways thanks for reporting back nice approach :+1:
:+1:
when, html bundling lands, it would be amazing, because we can bundle application into modules, and translation is part of that, so if we can make this lib works in a way that allows the files to be bundled we would achieve the ultimate goal :)
so, say we have a CMS, that has, BLog Module, Gallery Module, i would create a translation folder with all languages for each of those modules, and when i bundle i bundle each module in a way that it would include its js, css, image, ,etc.. files plus the json translation files, and in this way i can ship each module as package that can be dropped in any project, on top of that we achieve performance boost, because the gallery module and all its resources wont be loaded until user requests it.