Morten
Morten

Reputation: 4607

Is there a way to turn off localization in dojo?

I have Dojo, it has its own localization. I use Dojo to communicate with a REST API, which has it's own set of localization. I want to use my localization instead of Dojo's, which we've gotten to work. However, Dojo is still fetching it's localization bundle.

How do I prevent it from fetching its localization bundle?

Upvotes: 2

Views: 1326

Answers (2)

Stephen Chung
Stephen Chung

Reputation: 14605

There is no way not to load at least one bundle.

If you set djConfig="locale:'en'" in your script loading, then Dojo will assume it is running in the "en" locale. This is the absolutely minimum, as the "en" locale is always loaded -- it is the fall-back.

You have to make a custom build and merge the "en" bundle into the build file if you don't want it to load.

You may avoid loading the bundle if you do not use any dijit's or locale-dependent dojo functions (e.g. dojo.date.locale.format, dojo.number.format etc.) -- these will automatically initialize the i18n system and load at least the default locale "en".

Upvotes: 6

peller
peller

Reputation: 4543

If you use a feature in Dojo which uses dojo.i18n (mostly Dijit, also dojo.date, number and currency) then it will make requests for the necessary localization bundles over the network using the predetermined scheme. There's no way to disable it or redirect it, since the logic is built right in.

If you just want to use other parts of Dojo or build your own widgets, then you can build your own localization scheme.

Upvotes: 3

Related Questions