Flex DateChooser in Japanese Style
How I can change the display of Month and Year display to Japanese style 开发者_JAVA百科(i.e. Year Month) as in Header of Flex Date Chooser. What I would like to convert the style 8月 2011年 to 2011年 8月.
Code I used to do that,
dateFrom.dayNames = ['日', '月', '火', '水', '木', '金', '土'];
dateFrom.monthNames = ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'];
dateFrom.yearSymbol = "年";
where dateFrom is the id of the DateField.
In short, you should change date format in locale settings. When the year preceedes the month, DateChooser
shows labels accordingly.
1) Quick patch - set it manually on app start:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
preinitialize="application1_preinitializeHandler(event)">
<fx:Script>
<![CDATA[
protected function application1_preinitializeHandler(event:FlexEvent):void
{
var array:Array = resourceManager.getLocales();
for each (var locale:String in array)
{
var shared:IResourceBundle = resourceManager.getResourceBundle(locale, "SharedResources");
shared.content["dateFormat"] = "YYYY/MM/DD";
}
}
]]>
</fx:Script>
<mx:DateChooser />
</mx:Application>
2) Proper way - create locale resource with date format:
dateFormat=YYYY/MM/DD
More on this: http://livedocs.adobe.com/flex/3/html/help.html?content=l10n_6.html
精彩评论