Language Language Language Language Language Class

Definition

A class that provides information related to BCP-47 language tags such as the language name and the script.

public : sealed class Language
struct winrt::Windows::Globalization::Language
public sealed class Language
Public NotInheritable Class Language
var language = new language(languageTag);
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

// 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;
// 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;

Remarks

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:

Starting in : Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that these extensions can affect the numeral system or calendar used by globalization objects.

Version history

Windows version SDK version Value added
1803 17134 LayoutDirection

Constructors

Language(String) Language(String) Language(String) Language(String) Language(String)

Creates a Language object.

Properties

CurrentInputMethodLanguageTag CurrentInputMethodLanguageTag CurrentInputMethodLanguageTag CurrentInputMethodLanguageTag CurrentInputMethodLanguageTag

Gets the BCP-47 language tag for the currently enabled keyboard layout or Input Method Editor (IME).

DisplayName DisplayName DisplayName DisplayName DisplayName

Gets a localized string that is suitable for display to the user for identifying the language.

LanguageTag LanguageTag LanguageTag LanguageTag LanguageTag

Gets the normalized BCP-47 language tag for this language.

LayoutDirection LayoutDirection LayoutDirection LayoutDirection LayoutDirection

Gets the content layout direction (for text and UI elements) most appropriate for a language.

NativeName NativeName NativeName NativeName NativeName

Gets the name of the language in the language itself.

Script Script Script Script Script

Gets the four-letter ISO 15924 script code of the language.

Methods

GetExtensionSubtags(String) GetExtensionSubtags(String) GetExtensionSubtags(String) GetExtensionSubtags(String) GetExtensionSubtags(String)

Retrieves a vector of extension subtags in the current language for the given extension identified by singleton.

IsWellFormed(String) IsWellFormed(String) IsWellFormed(String) IsWellFormed(String) IsWellFormed(String)

Determines whether a BCP-47 language tag is well-formed.

TrySetInputMethodLanguageTag(String) TrySetInputMethodLanguageTag(String) TrySetInputMethodLanguageTag(String) TrySetInputMethodLanguageTag(String) TrySetInputMethodLanguageTag(String)

Tries to set the normalized BCP-47 language tag of this language.

See also