1

Flex 3でResourceBundleを使用して多言語アプリケーションで作業しています。データをDataGridに表示し、DataGridColumnheaderTextを次のように定義しています。

headerText="{localizedHeaderText('LABEL_USER_NAME')}

この関数はユーザー名のローカライズされたラベルを返しますが、動的に別の言語を選択すると、evertyingは更新されますが、headerTextラベルは表示されますか?

何かご意見は?

ありがとう

4

1 に答える 1

3

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:

  1. override resourcesChanged and dispatch a custom event
  2. add [Bindable(event="customEvent")] above the method

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);
}
于 2009-02-11T21:05:59.333 に答える