Opened 11 years ago

Closed 11 years ago

#8162 closed defect (invalid)

cross-domain loading of i18n bundles borked in chrome 0.3.154.9

Reported by: Peter Svensson Owned by: Adam Peller
Priority: high Milestone: tbd
Component: Internationalization Version: 1.2.0
Keywords: i18n, cross-domain, chrome Cc:
Blocked By: Blocking:

Description

Creating my own nls tree under a component and loading bundles cross-domain works fine in FF3 but in Chrome 0.3.154.9 I get the message "Uncaught Error: Bundle not found ..".

Version used is http://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dojo/dojo.xd.js

It might be fixed in later versions, but that's the latest out atm.

Change History (6)

comment:1 Changed 11 years ago by Adam Peller

can you provide an example?

comment:2 Changed 11 years ago by Peter Svensson

I have a simple widget like this;

--- dojo.provide("layout.translate");

dojo.require("dijit._Templated"); dojo.require("dijit._Widget"); dojo.require("dojo.i18n");

dojo.declare("layout.translate", [ dijit._Widget ], {

widgetsInTemplate : false, string : "",

postCreate: function() {

if (!this.string) {

this.string = this.domNode.innerHTML;

} console.log("postCreate for layout.translate called. locale == '"+dojo.locale+"'"); dojo.requireLocalization("layout", "salutations"); var res = dojo.i18n.getLocalization("layout", "salutations"); console.log("Translation key was '"+this.string+"'"); var str = res[this.string]; this.domNode.innerHTML = str;

}

});

---

I copied the nls directory under dojo/test/nls, even down to using the same 'salutations.js' jsut to see if it worked.

I load dojo in the following way:

--- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dojo/dojo.xd.js"

djConfig="parseOnLoad: true, baseUrl: './', modulePaths: {layout: 'wcn/layout', data: 'wcn/data'}, debug:true, debugAtAllCosts:true"></script>

---

And all other custom widgets etc. work OK and get found allright.

Cheers, PS

comment:3 Changed 11 years ago by bill

Shouldn't the requireLocalization() be at the top of the file rather than in postCreate? Or does that not matter?

Note the formatted version of above (lost by trac) is:

 dojo.provide("layout.translate");

 dojo.require("dijit._Templated");
 dojo.require("dijit._Widget");
 dojo.require("dojo.i18n");

 dojo.declare("layout.translate", [  dijit._Widget ],
 {
   widgetsInTemplate             : false,
   string                        : "",

   postCreate: function()
   {
     if (!this.string)
     {
       this.string = this.domNode.innerHTML;
     }
     console.log("postCreate for layout.translate called. locale ==
 '"+dojo.locale+"'");
     dojo.requireLocalization("layout", "salutations");
     var res = dojo.i18n.getLocalization("layout", "salutations");
     console.log("Translation key was '"+this.string+"'");
     var str = res[this.string];
     this.domNode.innerHTML = str;
   }

 });

---

I copied the nls directory under dojo/test/nls, even down to using the same 'salutations.js' jsut to see if it worked.

I load dojo in the following way:

---

 <script type="text/javascript"
 src="http://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dojo/dojo.xd.js"
         djConfig="parseOnLoad: true, baseUrl: './', modulePaths: {layout:
 'wcn/layout', data: 'wcn/data'}, debug:true,
 debugAtAllCosts:true"></script>

comment:4 Changed 11 years ago by Peter Svensson

Very sorry. i18n and chrome works perfectly. Had silly problem using 'new' as variable name which shot the page giving strange effects.

comment:5 Changed 11 years ago by Peter Svensson

So this means that the ticket can be closed, removed and duly thrown away. Have a nice Saturday.

Cheers, PS

comment:6 Changed 11 years ago by bill

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.