DatePicker pick up wrong word when we use LOCALE_WEEKDAYS with 1char in chinese.
--------------------------------------------------------------------------------
Key: WICKET-2218
URL: https://issues.apache.org/jira/browse/WICKET-2218
Project: Wicket
Issue Type: Bug
Components: wicket-datetime
Environment: any
Reporter: Neversay
Priority: Minor
When we use DatePicker in Chinese (TRADITIONAL_CHINESE or SIMPLIFIED_CHINESE),
the method substring(String[] array, int len) cuts wrong word in WEEKDAYS_SHORT
and WEEKDAYS_1CHAR.
It should be THIRD word in locale weekly message. So I write a subclass of
DatePicker and fix it.
I think it is a major bug for Chinese though you guys had fixed it by ad-hoc
re-assign a character array in simplified Chinese, but I think this should be
correct solution listing below:
protected void localize(Map widgetProperties){
...
if (Locale.SIMPLIFIED_CHINESE.equals(getLocale()) ||
Locale.TRADITIONAL_CHINESE.equals(getLocale()))
widgetProperties.put("WEEKDAYS_SHORT",
filterEmpty(substring(dfSymbols
.getShortWeekdays(), 2,1)));
...
}
/**
* An alternative solution for substring. It is equal to map(list,
substring(start, length))
*/
protected final String[] substring(String[] array, int start,int len){
if (array != null)
{
String[] copy = new String[array.length];
for (int i = 0; i < array.length; i++)
{
String el = array[i];
if (el != null)
{
if (el.length() > start)
{
copy[i] = el.substring(start,
start+len);
}
else
{
copy[i] = el;
}
}
}
return copy;
}
return null;
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.