-api-id | -api-type |
---|---|
T:Windows.Globalization.Language |
winrt class |
A class that provides information related to BCP-47 language tags such as the language name and the script.
If your app passes language tags used in this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.
Initialize this class with a BCP-47 language tag. For example, to work with the best current user-preferred language, pass in the top value from Windows.System.UserProfile.GlobalizationPreferences:
Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that these extensions can affect the calendar used by Calendar objects.
Windows version | SDK version | Value added |
---|---|---|
1803 | 17134 | LayoutDirection |
2004 | 19041 | AbbreviatedName |
2004 | 19041 | GetMuiCompatibleLanguageListFromLanguageTags |
// Get the top user-preferred language and its display name.
var topUserLanguage = Windows.System.UserProfile.GlobalizationPreferences.Languages[0];
var language = new Windows.Globalization.Language(topUserLanguage);
var displayName = language.DisplayName;
OCR sample (Windows 10), Globalization preferences sample (Windows 10)