Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I detect the system language of an iOS device using JavaScript? [duplicate]

Tags:

ios

cordova

I have found this previous question but it uses C. Is there a way to do this through JQuery or JavaScript?

like image 595
LiddleLaLoo Avatar asked Oct 21 '13 09:10

LiddleLaLoo


1 Answers

UPDATE: This plugin is not required any more, and its no longer included in default installations. The current way of obtaining it is navigator.language() See https://developer.mozilla.org/es/docs/Web/API/NavigatorLanguage/language


Below method will help you to find your device language using Cordova/Phonegap.

function checkLanguage() {
    navigator.globalization.getPreferredLanguage(
        function (language) {    
            alert('language: ' + language.value + '\n');
        },
        function () {
            alert('Error getting language\n');
        }
    );
}

Note: Check the Cordova Globalization plugin documentation for more.

like image 70
Mumthezir VP Avatar answered Oct 03 '22 12:10

Mumthezir VP