Opened 10 years ago

Closed 10 years ago

#14375 closed defect (fixed)

'invalid label' error when loading i18n resource file

Reported by: dholden Owned by: Rawld Gill
Priority: high Milestone: 1.7.2
Component: Loader Version: 1.7.0
Keywords: Cc:
Blocked By: Blocking:


Loading a JSON resource file, that requires localization and that does not have parenthesis [()] around the JSON object, causes an 'invalid label' error in the browser (FF 8.0).

Steps to reproduce: Call dojo.requireLocalization("../<resource location>", "strings") where strings.js is: {

"STRING_1" : "My String"


The "evalBundle" function, in dojo/dojo/i18n.js, calls "eval(bundle)" for each resource being loaded. Changing "eval(bundle)" to "eval('(' + bundle + ')')" would solve this problem.

Attachments (1)

14375.patch (800 bytes) - added by dholden 10 years ago.
Suggested Patch to i18n.js

Download all attachments as: .zip

Change History (8)

Changed 10 years ago by dholden

Attachment: 14375.patch added

Suggested Patch to i18n.js

comment:1 Changed 10 years ago by Adam Peller

Component: InternationalizationLoader
Owner: changed from Adam Peller to Rawld Gill

I believe the first argument to requireLocalization should be a package name, not a filepath (i.e. no "../") But it does sound like the eval should supply the parens.

comment:2 Changed 10 years ago by Rawld Gill

Milestone: 1.8
Status: newassigned

comment:3 Changed 10 years ago by Adam Peller


consider for 1.7

comment:4 Changed 10 years ago by bill


These didn't make it into the 1.7.1RC, so bumping them to 1.7.2 (as stated in the email I sent yesterday).

comment:5 Changed 10 years ago by dholden

depsScan.js has the same issue in evalNlsResource() - line 409:

var result= eval(text);

--should become--

var result= eval("("+text+")");

comment:6 Changed 10 years ago by Rawld Gill

In [27774]:

improved sniffing of i18n bundles in backcompat mode; fixed test; refs #14375; fixes #14222; refs #14226; !strict

comment:5 Changed 10 years ago by Rawld Gill

Resolution: fixed
Status: assignedclosed

In [27795]:

backport [27774], fixes #14375; !strict

Note: See TracTickets for help on using tickets.