I searched for flex localization and saw that it's not so quick to learn it.
here the steps for localization with running codes:
1- Go to flex_builder_install_path/sdks/3.0.0/bin
2- Run ./copylocale en_US tr_TR ( copylocale original_locale new_locale )
3- Add locale params to flex compiler args :
-locale=tr_TR,en_US -source-path=/java/flexWorkspace/vt-telepati-ui/src/locale/{locale} -allow-source-path-overlap=true ( -source-path= / projectPath/src/locale/{locale} )
4- in flex, directory structure related with localization should be so:
5- Fill the properties files.
grid.properties file under en_US :
ChangeColumns = Change Columns
Print = Print me
Save = Save
Delete = Delete please
flag = Embed("images/us_flag.gif")
grid.properties file under tr_TR :
ChangeColumns = Kolonlari degistir
Print = Yazdir
Save = Kaydet
Delete = Sil
flag = Embed("images/tr_flag.gif")
6- Use localization:
<mx:Script>
<![CDATA[
private function changeLocale():void{
var currentLocale:String = resourceManager.localeChain[0];
var newLocale:String = currentLocale=='en_US' ? 'tr_TR' : 'en_US';
resourceManager.localeChain = [newLocale];
}
]]>
</mx:Script>
<mx:Button label="{resourceManager.getString('grid' , 'Print') }" />
<mx:Label text="{resourceManager.getString('main' , 'ChangeColumns') }" />
<mx:Image source="{resourceManager.getClass('grid' , 'flag') }" />
<mx:Button label="change locale" click="changeLocale();" />
the result :
change locale clicked :
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder