Opened 10 years ago

Closed 10 years ago

#15057 closed defect (fixed)

custom build breaks i18n bundles with dojo 1.7.2

Reported by: waltercacau Owned by: Rawld Gill
Priority: high Milestone: 1.7.3
Component: BuildSystem Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:


Internationalization bundles generated by a custom build are broken with dojo 1.7.2 . The i18n plugin works fine if I don't use the build system.

I created a simple forked project based on a dojo-boilerplate project hosted on github that illustrates the issue.

If you have git and python in a unix box, you can get up and running running the following commands in the terminal:

git clone --recursive git://
cd dojo-boilerplate
python -m SimpleHTTPServer

Then access the unbuilt version at http://localhost:8000/src/ . Note that it respects the dojo.locale = "pt-br" as set in the data-dojo-config attribute of the script tag.

Now, access the built one at http://localhost:8000/dist/ and notice that it is showing in english. You can check in the browser's console that dojo.locale is "pt-br".

I am using an Ubuntu 10.04.3 LTS Lucid box and tested with Firefox 9.0.1 and Google Chrome 17.

I spent some time to figure out the issue and found that the resource bundle was being evaluated through dojo/i18n.js evalBundle function. This function actually substitutes the define function by a little stub assuming that the file which is being loaded contains only one define call. But generated bundle contains a require call with a cache config property contaning the bundled i18n resources. So, when these resources are evaluated, they call the stub define and not the global one.

This is illustrated by the app/nls/pt-br/Messages.js . If you look in the browser console output, you will see the output of a call to "console.log('...', define)".

I am not sure what is the best way to fix it, but for now a simple workaround is to use window.define in i18n resources.

Attachments (1)

0001-Fix-for-dojo-ticket-15057.patch (1.1 KB) - added by waltercacau 10 years ago.

Download all attachments as: .zip

Change History (8)

Changed 10 years ago by waltercacau

comment:1 Changed 10 years ago by waltercacau

That's just a small patch generated using git for the 1.7.2 release that I found on github: ( ).

It solves the issue for my use case at least.

comment:2 Changed 10 years ago by bill

Component: GeneralBuildSystem
Owner: set to Rawld Gill

comment:3 Changed 10 years ago by fabioginzel


comment:4 Changed 10 years ago by Rawld Gill

Milestone: tbd1.7.3
Priority: undecidedhigh
Status: newassigned

comment:5 Changed 10 years ago by Rawld Gill

In [28365]:

removed requirment for sync loader when including v1.x i18n backcompat; refs #14092; refs #15057; !strict

comment:6 Changed 10 years ago by Rawld Gill

Hi waltercacau! Thanks for your excellent report!

This is now working in trunk as of [28365]. I will backport to 1.7.3 before closing.

comment:7 Changed 10 years ago by Rawld Gill

Resolution: fixed
Status: assignedclosed

If any i18n fixes are backported, they will all be backported as a single commit which will be tracked on #14092.

Note: See TracTickets for help on using tickets.