oren.s
19 Apr 2012, 3:48 AM
As an example, I used a Japaneses locale, but I think it's a problem with many others.
My application has a timepicker, and it works great with English locale. When I change the locale to Japanese, dates and times are formatted correctly, as far as I can see. For example, take this line of code:
Ext.Date.format(new Date(), Ext.form.field.Time.prototype.format)
It returns the current time of the day, in the format of the current locale. If no format is defined for the locale, it uses a default. For English it may return "2:23 PM", and for Japanese "2:23 午後".
However, the timepicker validation fails for any value. As far as I can see it fails to parse its own formatted text as a valid time.
I took a look at the Japanese file 'ext-lang-ja.js', and saw the format is identical to the English format: 'g:i A', so as I understand the parsing of a Japanese-locale time is wrong, failing to recognize "午後" ("PM"). See the following line of code which formats a Date object and the parses the resulting String back to a Date, using the same format. It works (returns a Date) in English locale, and fails in Japanese locale.
Ext.Date.parse(
Ext.Date.format(new Date(), Ext.form.field.Time.prototype.format),
Ext.form.field.Time.prototype.format
)
I can override the locale, so it's possible to just not display and accept strings in many languages, which I intend to do for any unrecognized or 'unsupported' locale, but I want to resolve this for common languages. The point here is that a Japanese-specific solution is acceptable -- I'll just reproduce for the other languages I want to support.
Thanks.
My application has a timepicker, and it works great with English locale. When I change the locale to Japanese, dates and times are formatted correctly, as far as I can see. For example, take this line of code:
Ext.Date.format(new Date(), Ext.form.field.Time.prototype.format)
It returns the current time of the day, in the format of the current locale. If no format is defined for the locale, it uses a default. For English it may return "2:23 PM", and for Japanese "2:23 午後".
However, the timepicker validation fails for any value. As far as I can see it fails to parse its own formatted text as a valid time.
I took a look at the Japanese file 'ext-lang-ja.js', and saw the format is identical to the English format: 'g:i A', so as I understand the parsing of a Japanese-locale time is wrong, failing to recognize "午後" ("PM"). See the following line of code which formats a Date object and the parses the resulting String back to a Date, using the same format. It works (returns a Date) in English locale, and fails in Japanese locale.
Ext.Date.parse(
Ext.Date.format(new Date(), Ext.form.field.Time.prototype.format),
Ext.form.field.Time.prototype.format
)
I can override the locale, so it's possible to just not display and accept strings in many languages, which I intend to do for any unrecognized or 'unsupported' locale, but I want to resolve this for common languages. The point here is that a Japanese-specific solution is acceptable -- I'll just reproduce for the other languages I want to support.
Thanks.