Setting a different lang attribute on a widget seems not work in release mode

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting a different lang attribute on a widget seems not work in release mode

PaulChristopher
Not really sure about this, but my impression is as follows: If you serve a page in a certain language (e.g. 'en' by specifying locale:'en' in data-dojo-config), the web app gets broken if you set a different lang to an included widget with the lang-attribute like so:

<html lang="en">
...
<script src="dojo/dojo.js" data-dojo-config="async:true, parseOnLoad:true, locale:'en'></script>
...
<!-- Englisch date/time format please -->
<input data-dojo-type="dijit/form/TimeTextBox" lang="en-gb" />
...

The application fails, even if the build tool has generated an 'en' and 'en-gb' layer.

Moreover it fails with a meaningless error message, from which you cannot get the slightest clue that the lang attribute is the cause of the problem.

Is that correct? Does the lang attribute not work in release mode after a build? It works perfectly in debug mode without layers.
Reply | Threaded
Open this post in threaded view
|

Re: Setting a different lang attribute on a widget seems not work in release mode

PaulChristopher
This is probably a bug, see http://bugs.dojotoolkit.org/ticket/15630
Reply | Threaded
Open this post in threaded view
|

Re: Setting a different lang attribute on a widget seems not work in release mode

Adam Peller
In reply to this post by PaulChristopher
PaulChristopher wrote
Not really sure about this, but my impression is as follows: If you serve a page in a certain language (e.g. 'en' by specifying locale:'en' in data-dojo-config), the web app gets broken if you set a different lang to an included widget with the lang-attribute
In this case, you're configuring Dojo to serve a layer built for only the 'en' locale, therefore no information on variants comes down from the server.  That much seems consistent with the spec.  For the lang attribute, it seems that an exact match is required and that there's no search for matching locales.  Bug or feature, I'm not sure, but a helpful error message would certainly be nice.  What's the error message you get?

Reply | Threaded
Open this post in threaded view
|

Re: Setting a different lang attribute on a widget seems not work in release mode

PaulChristopher
Agreed, it is quite an unusal use case to serve a page in 'en' and set a different language just for one widget with the lang attribute (e.g. 'en-gb'). But in this case, I would expect, that Dojo tries to make an separate require call for the desired language ressource 'en-gb' (not the layer file en-gb!), so that you get in the network panel as loaded files the layer file for en and the original, unbuilt, separate i18n file for en-gb (like in debug mode with an unbuilt app).

Instead Dojo fails with a strang error message somewhere in my custom code. It gives me a "this.Button is undefined error". this.Button is a widget which has been imported by registry.byId on startup of the page-level controller's init function. So the error message has nothing to do with the lang attribute which is set to another widget. It took us quite some hours to figure out, that the reason for the trouble with our release version of our application was the lang attribute on the DateTextBox.

It was a quite uncomfortable situation like the one when our build failed because the build tool cannot handle hidden CVS files, see http://bugs.dojotoolkit.org/ticket/16106. Again it took us ours to figure out the reason for the failure.