How can I access to the language from device settings?
Thanks for all and your help
How can I access to the language from device settings?
Thanks for all and your help
<resources>
<strings>
<string id="UserLanguage">eng</string>
</strings>
</resources>
var language = Ui.loadResource(Rez.Strings.UserLanguage);
I don't think there is a specific method to access the device language, since the language stuff is automatically handled through the use of string resources separated out by language. What you might consider doing is putting a "lang" string in each language resource folder you are supporting and then you can check the value; I do something similar right now so as to access the device model.
<resources>
<strings>
<string id="UserLanguage">eng</string>
</strings>
</resources>
So the above XML would go in //<PROJECT_HOME>/resources-eng/language.xml and then you could create similar files in any other language-based resources folders. Then you could set a language variable when your app starts up.
var language = Ui.loadResource(Rez.Strings.UserLanguage);
How you use that variable? Because I do an if with the variable language and the simulator clear the display of the device
Thanks for your help
if (language.equals("english")) {
System.println("I'm English!");
} else {
System.println("I'm something else -- " + language);
}