I\'m creating a HTML5 mobile app that runs on all 3 mobile platforms (Android, iOS a,d Windows Mobile 8). I\'m using javascript for localization(https://github.com/eligrey/l
You can write your own JavaScript to grab the localisation language. This is the exact same reply I wrote elsewhere on here.
In general, the JavaScript window.navigator.language
usually works for iOS and newer Androids, but earlier versions of Android have it hardcoded to en
.
For older Androids I suggest pulling the language parameter out of the UserAgent string (yes sniffing!), e.g.
if (navigator && navigator.userAgent && (androidLang = navigator.userAgent.match(/android.*\W(\w\w)-(\w\w)\W/i))) {
lang = androidLang[1];
}
Here, lang might also contain the country code (e.g. 'en-IE') so you might have to remove that also:
if (lang.indexOf('-') != -1) lang = lang.substring(0, lang.indexOf('-'));
This is what I've used in a recent app, using HTML5 and PhoneGap, and it works fine.