A quick sample on how to pass in token values to a resource bundle string. When you need to replace a token value in your bundle, you will want to use the resourceManager or ResourceManager and pass in the value you want to replace in your bundle as an array, this is in the 3 parameter of the resourceManager’s getString() method.
Application
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:Metadata> [ResourceBundle("labels")] </mx:Metadata> <mx:Script> <![CDATA[ import mx.formatters.DateFormatter; import mx.resources.ResourceManager; [Bindable] private var _username:String; [Bindable] private var _date:String; private function setUsername( event:MouseEvent ):void { var tmpDate:Date = new Date(); _username = usernameInput.text; _date = tmpDate.getMonth() + "/" + tmpDate.getDay() + "/" + tmpDate.getFullYear(); } ]]> </mx:Script> <mx:TextInput id="usernameInput" /> <mx:Button label="Set Username" click="setUsername(event)" /> <mx:Label text="{resourceManager.getString('labels', 'welcomeMessage', [_username, _date])}" /> </mx:Application>
labels.properties
welcomeMessage = Welcome {0} Today is {1}





