[SOLVED] Difference between getPreferredLanguage & getLocaleName

Hi all!

Whats the difference between navigator.globalization.getPreferredLanguage & navigator.globalization.getLocaleName ?

Kind regards!

Need help for that. Any ideas?

If i use

    function (result) {alert('getLocaleName: ' + result.value + '\n');},
    function () {alert('Error getting getLocaleName\n');}
    function (result) {alert('getPreferredLanguage: ' + result.value + '\n');},
    function () {alert('Error getting getPreferredLanguage\n');}

i get de-AT at both requests (as example for “German (Austria)”)

What do u use? Whats the best way? Where is the real difference?

Android platform will always return the same value for both functions.

On the other hand:

getLocaleName will return Locale value
getPreferredLanguage will return Language

The locale is not same as Language.

The locale control how numbers, dates, and times display for your region.

Language settings control in what language text appears independently of the locale settings.

Many thanks to you @Gajotres! Thats the reason why i get the same result. :slight_smile:

1 Like