Flex配置通过配置语言环境实现多国语言
时间:2010-10-31 来源:daichangxin
1.自定义一个.properties格式的文件,文件内容的格式:
key = value
pic = Embed("demo.gif")
swf = Embed("demo.swf")
将这个文件复制到目录Adobe Flash Builder 4\sdk\4.0.0\frameworks\projects\framework\bundles\zh_CN下。
2.打开cmd命令,进入Adobe Flash Builder 4\sdks\4.0.0\bin,执行语句:
copylocale zh_CN New_cn
3.打开工程属性,在编译选项中 -locale zh_CN改为 -locale New_cn
4.每次更改语言文件均需要重新执行上面的操作。
5.使用语言包:
<mx:Metadata>
[ResourceBunle("包名")]
</mx:Metadata>
使用: 1> ResourceManager.getInstance().getString(包名, 包中某key);
2> <mx:Label text="@Resource(key='包中某key', bundle='包名')"/>
6在运行时改变语言资源:
ResourceManager.getInstance().localeChain = [包名的数组]; //会触发change事件。
相关阅读 更多 +