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

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -