Opened 8 years ago

Closed 8 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:

Description

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 8 years ago.
Suggested Patch to i18n.js

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by dholden

Attachment: 14375.patch added

Suggested Patch to i18n.js

comment:1 Changed 8 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 8 years ago by Rawld Gill

Milestone: 1.8
Status: newassigned

comment:3 Changed 8 years ago by Adam Peller

Milestone: 1.81.7.1

consider for 1.7

comment:4 Changed 8 years ago by bill

Milestone: 1.7.11.7.2

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 8 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 8 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 8 years ago by Rawld Gill

Resolution: fixed
Status: assignedclosed

In [27795]:

backport [27774], fixes #14375; !strict

Note: See TracTickets for help on using tickets.