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

This question already has an answer here:


ANSWERS:


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.



 MORE:


 ? Can't query iOS for current user language
 ? Getting Use of Undeclared Identifier error with imported method
 ? How to get NSNumberFormatter currency style from ISOCurrencyCodes?
 ? Set default language at first run IOS
 ? How to get automatic 12/24 hour formatting for NSDateFormatter based on current locale
 ? How to detect correctly language user of device objective-c?
 ? Know when to use short or full month names
 ? Getting row of UITableView cell on button press swift 3
 ? Getting row of UITableView cell on button press swift 3
 ? Getting row of UITableView cell on button press swift 3