[英]Is there a way to turn off localization in dojo?
I have Dojo, it has its own localization. 我有Dojo,它有自己的本地化。 I use Dojo to communicate with a REST API, which has it's own set of localization. 我使用Dojo与REST API进行通信,REST API具有自己的本地化集。 I want to use my localization instead of Dojo's, which we've gotten to work. 我想使用我的本地化而不是Dojo,我们已经开始工作了。 However, Dojo is still fetching it's localization bundle. 但是,Dojo仍在提取它的本地化软件包。
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. 如果在脚本加载中设置djConfig =“locale:'en'”,则Dojo将假定它在“en”语言环境中运行。 This is the absolutely minimum, as the "en" locale is always loaded -- it is the fall-back. 这是绝对最小的,因为“en”语言环境总是被加载 - 它是后退。
You have to make a custom build and merge the "en" bundle into the build file if you don't want it to load. 如果您不想加载,则必须进行自定义构建并将“en”包合并到构建文件中。
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". 如果您不使用任何dijit或依赖于语言环境的dojo函数(例如dojo.date.locale.format,dojo.number.format等),您可以避免加载bundle。这些将自动初始化i18n系统并至少加载默认语言环境“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. 如果您在Dojo中使用dojo.i18n(主要是Dijit,也是dojo.date,数字和货币)的功能,那么它将使用预定方案通过网络请求必要的本地化包。 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. 如果您只想使用Dojo的其他部分或构建自己的小部件,那么您可以构建自己的本地化方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.