Back to the blog. ActionScript Language detection
Well, once again around here… this time I want to start sharing useful code (at least it’s been useful for me), so I’m going to start publishing any code that I think made my jobs easier so I can give something back.
//////////////////////////////////////////////////////////////
// ActionScript Lang detection, Dario Novoa Special Thanks to Arnaldo Baumanis//
/////////////////////////////////////////////////////////////////////////
// First lets define a variable witch will contain the result of the system language detection
var lang = System.capabilities.language;
//then let’s define some cases of what to store in the variable depending on the findings, the detection will give back a 2 characters lang (example: en (english), es (spanish))…
if (lang == “es”) {
//here lets change the two character value to something more human readable (this is totally unnecessary but I did it anyways. (so if lang = es, then lang = spanish) ).
lang = “spanish”;
trace(“spanish”);
} else if (lang == “en”) {
lang = “english”;
trace(“english”);
} else if (idioma == “de”){
lang = “german”;
trace(“german”);
};
trace(“el idioma es “+lang);
//after all that we are simply detecting the language of the system and storing it into a variable now let’s make another case situation where if the language it’s spanish it will load a spanish movie into an empty MC or target MC.
function langChange () {
trace (lang);
if (lang == “undefined”) {
loadMovie(“menu_eng.swf”,container);
}
if (lang == “english”) {
trace (“its English, es ingles”);
loadMovie(“menu_eng.swf”,container);
btn_eng._alpha=100;
btn_spa._alpha=50;
//btn_gem._alpha=100; //para el futuro
getURL (“url”,”frame”);
}
if (lang == “spanish”) {
loadMovie(“menu_es.swf”,container);
btn_spa._alpha=100;
btn_eng._alpha=50;
//btn_gem._alpha=50; //para el futuro
getURL (“url/spanish.htm”,”frame”);
}
trace (lang);
}
///////////////////////THE END///////////////////////////
I hope it’s useful to someone…
Categorías Micelaneos | Etiquetas:



3 Comments to Back to the blog. ActionScript Language detection
by kpi
On Abril 14, 2008 at 1:05 am
aqui tengo q dar hasta el nombre ypartida de nacimiento de tapon para dejar un comentario?? y de paso lo que iba a decir era una bobada q ahora hasta pena me da jajaja…. pues diria “boh no entiendo nada jajaja, q divertido tenerte de amigo” jajaja idiota si… q quiers q diga… soy asi… beso…
by kpi
On Abril 14, 2008 at 1:10 am
y de paso tengo que esperar que me aprueben!!! nooooo!! me niego!! libertad libertad…
by dario
On Abril 14, 2008 at 2:13 am
Listo abierto para q todos comenten… espero q estes feliz!!