I dint follow the whole thread, but i noticed
"includes" are used.
So if u need the locale thingies in more then one mxml
the locale thingies will be included in all of the files, wich is offcourse
not efficient.
I would say a class would be more approprate, maybe
something like this:
class
fly.language.LanguageManager
{ static private var _currentLanguage_str:String; static public function init(init_obj:Object):Void { _currentLanguage_str = init_obj.language; }; static public function getLanguage():String { return _currentLanguage_str; }; static public function getText(type_str:String):String { return (_global.fly.language[_currentLanguage_str][type_str]); }; }; Then u
have locale files like this:
class
fly.language.English
{ static public var name:String = "Name"; static public var adress:String = "Adress"; static public var phoneNumber:String = "Phonenumber"; static public var send:String = "Send"; }; class
fly.language.Dutch
{ static public var name:String = "Naam"; static public var adress:String = "Adres"; static public var phoneNumber:String = "Telefoonnummer"; static public var send:String = "Verzenden"; }; Then in your
application u would have this:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="start()"> <mx:Script>
<![CDATA[
import fly.language.LanguageManager
public function start()
{
//make sure one of the language classes is included in the
application
//fly.language.Dutch;
fly.language.English;
fly.language.LanguageManager.init({language:
"English"});
};
]]>
</mx:Script>
<mx:Form>
<mx:FormItem label="{LanguageManager.getText("name")}"> <mx:TextInput /> </mx:FormItem> <mx:FormItem label="{LanguageManager.getText("adress")}"> <mx:TextArea /> </mx:FormItem> <mx:FormItem label="{LanguageManager.getText("phoneNumber")}"> <mx:TextInput /> </mx:FormItem> <mx:FormItem> <mx:Button label="{LanguageManager.getText("send")}" /> </mx:FormItem> </mx:Form> </mx:Application> This
makes sure that your language translations are included only once in your
application. And reachable in every class via the
LanguageManager.
Greetz
Erik
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Matt Chotin Sent: dinsdag 28 juni 2005 7:30 To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] globalisation in flex.. Search the docs for the
whitelist, its mentioned in plenty of places. As for your
buttons: <mx:Button
label=French click=locale = fr_FR /> <mx:Button
label=English click=locale = en_US /> Matt From:
hi Matt, I tried the
approach 3 but i get an error which says "Http service fault" you are not
allowed to access the url http://localhost:8088/flex/globalisatio/en_US.xml
via this proxy. This URL is not in the proxy's whitelist. what does it mean?
and I tried the approach 2. the code is
: <?xml version="1.0"?> here say i have 2 buttons , one for english and
other for french. how should i make it work? please send me the code for
this.. thanks, nithya -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com ---- LSpots keywords ?> ---- HM ADS ?> YAHOO! GROUPS LINKS
|
- RE: [flexcoders] globalisation in flex.. Erik Westra
- [flexcoders] Re: globalisation in flex.. anant_gilra