Export (0) Print
Expand All

browserLanguage property

Retrieves the current operating system language.

Note  This property does not indicate the language or languages set by the user in Language Preferences, located in the Internet Options dialog box.

Syntax

HRESULT value = object.get_browserLanguage(* p);

Property values

Type: BSTR

one of the values in the Language Codes.

Remarks

The IOmNavigator::browserLanguage property reflects the language of the operating system regardless of the installed language version of Windows Internet Explorer. However, if Windows 2000 MultiLanguage version is installed, the IOmNavigator::browserLanguage property indicates the language set in the operating system's current menus and dialogs, as found in the Regional Options of the Control Panel. For example, if you install a Japanese version of Microsoft Internet Explorer 5 on an English (United Kingdom) operating system, IOmNavigator::browserLanguage would be en-gb. If you install Windows 2000 MultiLanguage version and set the language of the menus and dialogs to French, IOmNavigator::browserLanguage would be fr, even though you have a Japanese version of Internet Explorer.

Prior to Internet Explorer 5, the IOmNavigator::browserLanguage property reflected the language of the installed browser's user interface. For example, if you installed a Japanese version of Internet Explorer on an English operating system, IOmNavigator::browserLanguage would have been ja.

Detecting language in Windows Store apps

For Windows Store appDon't use this property to get the app language in a Windows Store app. Use Windows.System.UserProfile.GlobalizationPreferences.languages to get the user's language list and Windows.Globalization.ApplicationLanguages.languages to get the app's current language.

You can also use the languages property of the default resourceContext. You can get the default resource context of the app from the DefaultContext property of the ResourceManager in the Windows.ApplicationModel.Resources.Core namespace.


Windows.ApplicationModel.Resources.Core.ResourceManager.current.defaultContext.languages


For more info, see How to manage language and region (Windows Store apps using JavaScript and HTML) .

Examples

The following example displays the language reported by the browser.


<p>Current language is: <span id="browserLang">unknown</span>.</p>

<script type="text/javascript">
window.onload = function() {
    var spn = document.getElementById('browserLang');
    spn.innerHTML = navigator.browserLanguage;
}
</script>


See also

Reference
IOmNavigator::systemLanguage
IOmNavigator::userLanguage

 

 

Community Additions

ADD
Show:
© 2014 Microsoft