How to determine the language on the device.
Monkey Targets Forums/Android/How to determine the language on the device.
| ||
Hello. Excuse my bad English. I want to know. How can I determine which language is used on the Android device. |
| ||
You will need to create an Extern to expose one of the following Android commands:Locale.getDefault().getLanguage() // ---> en Locale.getDefault().getISO3Language() // ---> eng Locale.getDefault().getCountry() // ---> US Locale.getDefault().getISO3Country() // ---> USA Locale.getDefault().getDisplayCountry() // ---> United States Locale.getDefault().getDisplayName() // ---> English (United States) Locale.getDefault().toString() // ---> en_US Locale.getDefault().getDisplayLanguage()// ---> English So create a Monkey file: Import "native/MyExtern.java" Extern Function GetDisplayLanguage:String()="MyExtern.getDisplayLanguage" And create the extern Java file: Import java.util.Locale; class MyExtern { static String getDisplayLanguage() { return Locale.getDefault().getDisplayLanguage(); } } * Not tested |