Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#10784 closed defect (wontfix)

form.DateTextBox doesn't support dynamic language switch

Reported by: timdp Owned by:
Priority: high Milestone: tbd
Component: Dijit - Form Version: 1.4.0
Keywords: dijit i18n Cc:
Blocked By: Blocking:


When loading additional languages using djConfig.extraLocale, the DateTextBox? does not switch languages when it's "lang" attribute is set.

The below example illustrates the problem.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
@import "dojo/resources/dojo.css";
@import "dijit/themes/tundra/tundra.css";
@import "dijit/themes/tundra/Calendar.css";
<div id="localLong" type="text" name="date1" value="2005-12-30"
					invalidMessage="Invalid date." > 
<button id="switch">Switch language</button>

<script src="dojo/dojo.js" djconfig="locale:'en-gb', extraLocale:['de-de']"></script>

dojo.addOnLoad(function () {

	var x = new mywidget({}, dojo.byId("widget"));
	dojo.connect(dojo.byId("switch"), "onclick", null, function() {
		var dtb = dijit.byId("localLong");
		dtb.lang = "de-de";
		dtb.validate(dtb.value, dtb.constraints);

Change History (7)

comment:1 Changed 12 years ago by timdp

Sorry, you'll need to lose the "var x =" line - I meant to strip that out.

comment:2 Changed 12 years ago by Adam Peller

Component: InternationalizationDijit
Owner: Adam Peller deleted

The 'lang' attribute is non-mutable... that should probably be documented. There isn't any support for changing this dynamically on any widget AFAIK or triggering a re-draw of the Calendar UI, in general. However, you can destroy and reinstantiate the widget with the new lang.

comment:3 Changed 12 years ago by Adam Peller

Resolution: wontfix
Status: newclosed

Confirmed that we documented this -- lang [const]

comment:4 Changed 12 years ago by timdp

How will the docs get updated off the back of this please?

Also, could you provide an example of how to destroy/recreate with all the same attributes (apart from lang!) in place?

comment:5 Changed 12 years ago by dante

not sure about the first question. the second could be:

var englishDefaults = {
    lang: "en", id:"bar", something:"else"

var x = new dijit.form.DateTextBox(englishDefaults);

var germanDefaults = dojo.mixin({}, englishDefaults, { lang:"de" });
var gx = new dijit.form.DateTextBox(germanDefaults);

comment:6 Changed 12 years ago by Adam Peller

So it's non-obvious and I'm not sure our doc tools render tags in our doc like [const] but it is in the source. From 1.4.1:

74	        // lang: [const] String
75	        //              Rarely used.  Overrides the default Dojo locale used to render this widget,
76	        //              as defined by the [HTML LANG]( attribute.
77	        //              Value must be among the list of locales specified during by the Dojo bootstrap,
78	        //              formatted according to [RFC 3066]( (like en-us).
79	        lang: "",

comment:7 Changed 11 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.