简体   繁体   中英

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?

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 (eg dojo.date.locale.format, dojo.number.format etc.) -- these will automatically initialize the i18n system and load at least the default locale "en".

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM