| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:mx="library://ns.apache.org/royale/mx" |
| width="600" height="400" |
| layout="horizontal"> |
| |
| <fx:Metadata> |
| [ResourceBundle("Something")] |
| </fx:Metadata> |
| |
| |
| <fx:Script> |
| <![CDATA[ |
| |
| [Bindable] |
| public var activeLocale:String = ''; |
| |
| |
| private function swapLocale():void{ |
| var locales:Array = resourceManager.getLocales(); |
| var old:String = resourceManager.localeChain[0]; |
| if (locales.indexOf(old) != -1) { |
| locales.splice(locales.indexOf(old), 1); |
| } |
| var idx:uint = Math.random()* locales.length; |
| activeLocale= locales[idx]; |
| resourceManager.localeChain = [activeLocale]; |
| } |
| ]]> |
| </fx:Script> |
| |
| |
| <mx:Button label="{'Swap Locale '+activeLocale}" click="swapLocale()"/> |
| <mx:VBox> |
| <mx:Label text="{resourceManager.getString('Something','TEST1')}" /> |
| <mx:Label text="{resourceManager.getString('Something','TEST2')}" /> |
| <mx:Label text="{resourceManager.getString('Something','TEST3')}" /> |
| <mx:Label text="{resourceManager.getString('Something','TEST4')}" /> |
| <mx:Label text="{resourceManager.getString('Something','TEST5')}" /> |
| <mx:Label text="{resourceManager.getString('Something','TEST6')}" /> |
| <mx:Label text="{resourceManager.getString('Something','TEST7',['{something}','{another}'])}" /> |
| </mx:VBox> |
| |
| </mx:Application> |