Flex 3 DataGridColumn HeaderText 本地化 [英] Flex 3 DataGridColumn HeaderText Localization

查看:20
本文介绍了Flex 3 DataGridColumn HeaderText 本地化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Flex 3 中的 ResourceBundle 的多语言应用程序中工作.我在 DataGrid 中显示数据并像这样定义 DataGridColumn headerText

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')}

此函数返回用户名的本地化标签,但是当我动态选择另一种语言时,evertying 会刷新但 headerText 标签?

this function returns the localized label for the username, but when I dynamcally select another language evertying gets refreshed but the headerText labels?

有什么想法吗?

谢谢

推荐答案

除非您使 localizedHeaderText 方法可绑定,否则永远不会重新评估绑定,因为它不知道 resourceManager 的更改事件.

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.

假设您在 UIComponent 子类中,您需要执行以下操作:

Assuming you are in a UIComponent subclass, you'll need to do the following:

  1. 覆盖 resourcesChanged 并调度自定义事件
  2. 在方法上方添加 [Bindable(event="customEvent")]

示例代码:

override protected function resourcesChanged():void {
    super.resourcesChanged();
    dispatchEvent(new Event("localeChange"));
}

[Bindable(event="localeChange")]
public function localizedHeaderText(key:String):String {
    return resourceManager.getString('resources', key);
}

这篇关于Flex 3 DataGridColumn HeaderText 本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆