Refresh (reload) content after language change


hi,

 

my mobile app supports different languages , option select language @ settings screen. obviously, text fields , buttons need 'refreshed' in order new language take effect. best way it? thought reloading app's main content not find info on how mobile air app.

 

thanks in advance.

you set language phrases on bindable variables. link text components them. language change redefines value of variables, instantly modifing labels, textareas, etc..

 

example:

 

// on data model (you set whole class bindable) // define different language labels [bindable] public var labelusername:string; [bindable] public var labelpassword:string;  // on action controller // action modifies current language protected function changelanguage(newlanguage:string):void {      switch(newlanguage)      {           case 'english':                langmodel.labelusername = 'username';                langmodel.labelpassword = 'password';                break;           case 'spanish':                langmodel.labelusername = 'nombre de usuario';                langmodel.labelpassword = 'contraseña';                break;      } }  // on view, text component <s:label text="{langmodel.labelusername}" /> 

 

this way, anytime call "changelanguage()" method, label reflect changes inmediatly.



More discussions in AIR Development


adobe

Comments

Popular posts from this blog

Some mp4 files not displaying correctly (CS6)

Thread: Samba is not authenticating with LDAP