Is there a way to load only one language with the require.js i18n plugin?
With the default settings, the default language is always loaded, and then the language with the locale of your browser is also loaded.
I'm looking for a solution in which the default language will not be compiled in the app.js, but loaded after when require.js has checked the browser locale.
Ok I've got it. You have to set set root
to false
in the base i18n.js file:
define({
"root": false,
"de": true,
"en": true
});
In this case only the above json will be rendered in your optimized version. And after loading require.js decide which langauge to load. Note that you lost the default language and you have to make sure to set all properties in all your languages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With