Apache flex 关于Flex树本地化

Apache flex 关于Flex树本地化,apache-flex,localization,Apache Flex,Localization,我使用mx:XML作为mx:Tree的数据源,并希望显示本地化的值 XML看起来像: <myTag label="component.mytextKey.txt"/> 然后在mx:Tree中,我指定labelField=“@label”来显示值 mx:Tree将“component.mytextKey.txt”显示为未翻译文本 我试图使用@Resource(key='@label,bundle='mybundle')和{resourceManager.getString('mybu

我使用mx:XML作为mx:Tree的数据源,并希望显示本地化的值

XML看起来像:

<myTag label="component.mytextKey.txt"/>
然后在mx:Tree中,我指定labelField=“@label”来显示值

mx:Tree将“component.mytextKey.txt”显示为未翻译文本

我试图使用
@Resource(key='@label
bundle='mybundle')
{resourceManager.getString('mybundle',@label)}
作为mx:Tree中labelFIeld的值。一切都不走运

我还尝试将的值指定为: 仍然不走运,树试图按原样显示标签,而不是显示规避值

有什么建议吗


谢谢。

@Resource是一个构建时命令。您可以尝试使用labelFunction和ResourceManager加载本地化数据,如下所示:

<mx:Tree labelFunction="{myLabelFunction}" />

function myLabelFunction(item:XML):String{ 
    return ResourceManager.getInstance().getString("BundleName", item.@label.toString());
}

函数myLabelFunction(项:XML):字符串{
返回ResourceManager.getInstance().getString(“BundleName”,item.@label.toString());
}

@Resource是一个构建时命令。您可以尝试使用labelFunction和ResourceManager加载本地化数据,如下所示:

<mx:Tree labelFunction="{myLabelFunction}" />

function myLabelFunction(item:XML):String{ 
    return ResourceManager.getInstance().getString("BundleName", item.@label.toString());
}

函数myLabelFunction(项:XML):字符串{
返回ResourceManager.getInstance().getString(“BundleName”,item.@label.toString());
}

也不要忘记任何不被视为字符串文字的东西,它们需要包装在绑定大括号中(例如{})。这告诉编译器它是从方法、属性等派生的值。

也不要忘记任何不被视为字符串文字的内容,需要包装在绑定大括号中(例如{})。这告诉编译器它是从方法、属性等派生的值