Download only one language from require.js i18n

Is there a way to download only one language using the require.js i18n plugin?

With the default settings, the default language is always loaded, and then the language with the language version of your browser is loaded.

I am looking for a solution in which the default language will not be compiled in app.js but loaded after require.js checks the browser locale.

+6
source share
1 answer

Well, I did it. You must 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 displayed in your optimized version. And after loading require.js decide which langauge to load. Please note that you have lost the default language, and you must definitely set all the properties in all your languages.

+6
source

Source: https://habr.com/ru/post/919902/


All Articles