简体   繁体   English

日式 Flex DateChooser

[英]Flex DateChooser in Japanese Style

How I can change the display of Month and Year display to Japanese style (ie Year Month) as in Header of Flex Date Chooser.如何将月份和年份的显示更改为日式(即年月),如 Flex 日期选择器的 Header 中所示。 What I would like to convert the style 8月 2011年 to 2011年 8月.我想将样式 8 月 2011 年转换为 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.其中 dateFrom 是 DateField 的 id。

In short, you should change date format in locale settings.简而言之,您应该在区域设置中更改日期格式。 When the year preceedes the month, DateChooser shows labels accordingly.当年份先于月份时, DateChooser会相应地显示标签。

1) Quick patch - set it manually on app start: 1) 快速补丁 - 在应用启动时手动设置:

<?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: 2)正确的方法 - 创建具有日期格式的语言环境资源:

dateFormat=YYYY/MM/DD

More on this: http://livedocs.adobe.com/flex/3/html/help.html?content=l10n_6.html更多信息: http://livedocs.adobe.com/flex/3/html/help.html?content=l10n_6.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM