Reputation:
I'm working in a multi-language application using ResourceBundle in Flex 3. I'm displaying data in a DataGrid and defined DataGridColumn headerText like this
headerText="{localizedHeaderText('LABEL_USER_NAME')}
this function returns the localized label for the username, but when I dynamcally select another language evertying gets refreshed but the headerText labels?
Any thoughts?
Thanks
Upvotes: 1
Views: 2008
Reputation: 16085
Unless you make the localizedHeaderText method bindable, the binding will never be re-evaluated since it does not know about the change event of the resourceManager.
Assuming you are in a UIComponent subclass, you'll need to do the following:
Sample code:
override protected function resourcesChanged():void {
super.resourcesChanged();
dispatchEvent(new Event("localeChange"));
}
and
[Bindable(event="localeChange")]
public function localizedHeaderText(key:String):String {
return resourceManager.getString('resources', key);
}
Upvotes: 3