cordova - Phonegap javascript globalization detect languages and redirect to .html files -
i know topic before can´t find proper solution it.
i want detect language on devices phonegap, can redirect user right indexlanguagex.html document.
i´ve got code phonegap documentation:
function checklanguage() { navigator.globalization.getpreferredlanguage( function (language) {alert('language: ' + language.value + '\n');}, function () {alert('error getting language\n');} ); }
this should check preferred language , alert it, right? doesn´t work on android device.. tried phonegap alert version, doesn´t work either.
can tell me how can work?
after alert, still need redirect. thought work like:
function (language) {if (language.value=us_en) { window.locaton="indexlanguagex.html"}},
figured out topic
function checklanguage() { navigator.globalization.getpreferredlanguage( function (language) { if(language.value == "english") { window.location.replace("newdocument.html"); } }, function () { alert('error getting language\n'); } ); }
Comments
Post a Comment