PDA

View Full Version : DatePicker Localization



echowang
18 Sep 2015, 7:33 AM
The DatePicker is using the first letter to represent days of a week, saw it in Date.js:

getDayInitial: function(value){ return value.substr(0,1); }

It works in most languages but not in Chinese. In Chinese it should use the last character. Is it a known issue? Any recommended work around?

53267

bjdurham85
21 Sep 2015, 5:51 AM
Hi echowang,

Take a look at this example, while I haven't tested this with your example it should be a good start to get you going.

http://dev.sencha.com/deploy/ext-4.0.0/examples/locale/multi-lang.html?lang=ja&charset=utf-8


Regards,
Bryan

echowang
22 Sep 2015, 7:33 AM
Hi Bryan, thanks for the demo! The day of the week are correct in your demo.
What Ext version did you use? I am using 4.2.

bjdurham85
22 Sep 2015, 7:36 AM
I believe 4.0 but shouldn't have changed much for localization. Here is the 4.2 link:

http://docs.sencha.com/extjs/4.2.4/extjs-build/examples/locale/multi-lang.html


Regards,
Bryan

echowang
28 Sep 2015, 11:27 AM
In your example. the dayNames returned are already the simplified day names:

Ext.Date.dayNames=["?","?","?","?","?","?","?"];

But in my application it returns me the full day names:

Ext.Date.dayNames=["???","???","???","???","???","???","???"];

Then Date.js substring to get the first character which I think it's a bug.

My workaround is override the getDayInitial function, return a dayShortNames if it exists, else call parent.