Opened 9 years ago
Closed 9 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)
Change History (8)
Changed 9 years ago by
Attachment: | 14375.patch added |
---|
comment:1 Changed 9 years ago by
Component: | Internationalization → Loader |
---|---|
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 9 years ago by
Milestone: | → 1.8 |
---|---|
Status: | new → assigned |
comment:4 Changed 9 years ago by
Milestone: | 1.7.1 → 1.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 9 years ago by
depsScan.js has the same issue in evalNlsResource() - line 409:
var result= eval(text);
--should become--
var result= eval("("+text+")");
Suggested Patch to i18n.js