Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load only one language with require.js i18n

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.

like image 799
Andreas Köberle Avatar asked Jul 06 '12 20:07

Andreas Köberle


1 Answers

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.

like image 154
Andreas Köberle Avatar answered Nov 01 '22 08:11

Andreas Köberle