Opened 9 years ago

Closed 7 years ago

#11593 closed defect (invalid)

Error on call of dojo.requireLocalization when resource is missing (only with CDN)

Reported by: Chris2 Owned by: James Burke
Priority: high Milestone: tbd
Component: BuildTools Version: 1.4.0
Keywords: i18n, Localization, CDN Cc: James Burke
Blocked By: Blocking:


When dojo.requireLocalization is called and the requested resource ("de" in my case) is not available firebug shows up an error. This behaviour only occurs when an CDN is used. When i use a local dojo firebug also shows that it was not able to load the (de-) resources but its not shown as an error. This should be the correct behavior because the default-messages are still available so there is no reason to display an error for every locale which my webapp does not support.

Attachments (1)

dojo-cdn-error.png (85.7 KB) - added by Chris2 9 years ago.
Screenshot of firebug(1.5.4) behaviour when using CDN and local server

Download all attachments as: .zip

Change History (7)

comment:1 Changed 9 years ago by Eugene Lazutkin

I don't know if it would help you or not but my situation was like that: I wanted to provide a 1-2-3-4 layer files to be loaded from one place to all other domains --- kind of like CDN, but without the XD loader. In fact I didn't expect any loading at all because all necessary modules were baked in. I even fixed my locale to 'en' (the apps do not support any other locales anyway). Still I got NLS-related calls, which broke IE when used cross-domain.

I fixed it.

First of all I suppressed the automatic loading of NLS files by including a following module as my dojo.js dependency:


// surgery --- suppress preloading of resources

  dojo.i18n._preloadLocalizations = function(){};

Now if I include djConfig="locale: 'en', suppressLocales: true" no NLS files are loaded automatically.

Secondly I included all necessary NLS files (and my layer) manually:

<script src="" djConfig="locale: 'en', suppressLocales: true"></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>

It did it for me.

What I didn't try is to include NLS files directly as a build dependency --- I am not sure it'll work. But you can always concatenate all files post-build manually.

comment:2 Changed 9 years ago by ben hockey

i just wanted to add some background here since i talked with chris2 on irc about this. he is trying to use dojo from a cdn (aol in his case) but he has some code locally and wants to include some localization files for his code from his local server. the files don't currently exist and his concern is that when using dojo locally, this just generates a warning but when using dojo from the CDN it generates an error.

  1. is it possible to use dojo from a CDN with some localization files locally for his custom code?
  2. can he stop it from generating an error if the file doesn't exist?

Changed 9 years ago by Chris2

Attachment: dojo-cdn-error.png added

Screenshot of firebug(1.5.4) behaviour when using CDN and local server

comment:3 Changed 9 years ago by Adam Peller

Cc: James Burke added

I believe you're supposed to "build" all the locales you plan to support when using the build system, even if that means the build system will just duplicate the root (default) bundle to locales you do not translate to. James, what's the expected behavior if a locale is used which is not on the locale list? Is this error expected?

comment:4 Changed 8 years ago by Adam Peller

Component: InternationalizationBuildTools
Owner: changed from Adam Peller to James Burke

comment:5 Changed 7 years ago by bill

@peller - is this still an issue with the new format for message files etc.?

comment:6 Changed 7 years ago by Adam Peller

Resolution: invalid
Status: newclosed

[Editing... sorry, I didn't scroll down to see the additional errors] As @bill says, going forward the new resource bundle format directly references locales and variants, so there will be no 404 if the locale is not defined.

Last edited 7 years ago by Adam Peller (previous) (diff)
Note: See TracTickets for help on using tickets.