Simple extension for OpenFL that returns the language of the device where the app is running. Supporting currently HTML5, Flash, Windows, Linux, iOS and Android targets (contribution for missing targets is welcome)
Ipsilon Developments Inc. released under MIT license
Like our Facebook page to get news about our releases
Or Follow us on Twitter
You can also contact us at info [AT] ipsilondev.com
First of all, install the lib:
haxelib install devicelanguage
Once this is done, you just need to add this to your project.xml
<haxelib name="devicelanguage" />
then from haxe, just do:
// This example show a simple use case.
import extension.devicelang.DeviceLanguage;
var lang:String = DeviceLanguage.getLang();
returns a string representing the language in ISO-639-1 format for Flash, Windows, Linux, Android and iOS target and in similar way, for html5 target, just that also includes the country (for example, Android would return "en" for english, and in html5 could return "en-US")