nihavend opened a new issue #824: URL: https://github.com/apache/royale-asjs/issues/824
Changing local for menubar has no affect whicih content is defined in XMLList including resources. It behaves different from flex. related with #545 When you click the button the locale is going to change. You have to define resource file and add the tokens > en : switchLocale = Switch Locale > tr : switchLocale = Dili Değiştir Test Case Source code : ``` <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.apache.org/royale/spark" xmlns:mx="library://ns.apache.org/royale/mx" paddingBottom="0" paddingTop="0" paddingLeft="0" paddingRight="0" creationComplete="init()" height="100%" width="100%" > <fx:Metadata> [ResourceBundle("messages")] </fx:Metadata> <fx:Script> <![CDATA[ import mx.resources.ResourceManager; import mx.collections.XMLListCollection; import mx.events.FlexEvent; import mx.events.MenuEvent; [Bindable] public var menuBarData2:XMLListCollection = new XMLListCollection(); protected function creationCompleteHandler2(event:FlexEvent):void { var roleInfo:String = "ADMIN"; var tmpXmlList:XMLListCollection = new XMLListCollection(); tmpXmlList.source = menuDataXMLList; menuDataXMLList = tmpXmlList.source.copy(); menuBarData2.source = menuDataXMLList; menuBarData2.refresh(); } protected function itemClickHandler(event:MenuEvent):void { } private function init():void { resourceManager.localeChain = ["en_US"]; } private function changeLocale():void { var locale:String = resourceManager.localeChain[0]; if(resourceManager.localeChain[0] != "en_US") { resourceManager.localeChain = ["en_US"]; } else { resourceManager.localeChain = ["tr_TR"]; } } private function dummyMethod(event:MouseEvent):void { } ]]> </fx:Script> <fx:Declarations> <fx:XMLList id="menuDataXMLList"> <menuitem label="label-1"> <menuitem label="label-1-1"/> <menuitem label="label-1-2"/> </menuitem> <menuitem label="{resourceManager.getString('messages', 'switchLocale')}" id="admin" > <menuitem label="label-2-1"/> <menuitem label="label-2-2"/> <menuitem label="{resourceManager.getString('messages', 'switchLocale')}" id="admin" /> </menuitem> </fx:XMLList> </fx:Declarations> <s:layout> <s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" paddingTop="10" paddingBottom="20" /> </s:layout> <s:Button label="{resourceManager.getString('messages', 'switchLocale')}" click="changeLocale()"/> <mx:MenuBar id="menuBar_fx_Declarations" width="100%" dataProvider="{menuBarData2}" horizontalCenter="0" itemClick="itemClickHandler(event)" labelField="@label" creationComplete="creationCompleteHandler2(event)"/> </s:Application> ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
