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 : ILanguage, ILanguageExtensionSubtagspublic sealed class Language : ILanguage, ILanguageExtensionSubtagsPublic NotInheritable Class Language Implements ILanguage, ILanguageExtensionSubtags// You can use this class in JavaScript.
- Attributes
| 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.
Constructors
Language(String) Language(String) Language(String) Language(String)
Properties
CurrentInputMethodLanguageTag CurrentInputMethodLanguageTag CurrentInputMethodLanguageTag CurrentInputMethodLanguageTag
Gets the BCP-47 language tag for the currently enabled keyboard layout or Input Method Editor (IME).
public : static PlatForm::String CurrentInputMethodLanguageTag { get; }public static string CurrentInputMethodLanguageTag { get; }Public Static ReadOnly Property CurrentInputMethodLanguageTag As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The BCP-47 language tag.
- See Also
DisplayName DisplayName DisplayName DisplayName
Gets a localized string that is suitable for display to the user for identifying the language.
public : PlatForm::String DisplayName { get; }public string DisplayName { get; }Public ReadOnly Property DisplayName As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The localized name of the language.
LanguageTag LanguageTag LanguageTag LanguageTag
Gets the normalized BCP-47 language tag for this language.
public : PlatForm::String LanguageTag { get; }public string LanguageTag { get; }Public ReadOnly Property LanguageTag As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The normalized BCP-47 language tag.
Starting in : Language tags can support Unicode extensions. See the Remarks for the Language constructor.
- See Also
NativeName NativeName NativeName NativeName
Gets the name of the language in the language itself.
public : PlatForm::String NativeName { get; }public string NativeName { get; }Public ReadOnly Property NativeName As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The name of the language in the language itself.
Script Script Script Script
Gets the four-letter ISO 15924 script code of the language.
public : PlatForm::String Script { get; }public string Script { get; }Public ReadOnly Property Script As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
A string with the script code of the language. If the script code cannot be identified or inferred from the language tag, "Zyyy" is returned.
Methods
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.
public : IVectorView<PlatForm::String> GetExtensionSubtags(PlatForm::String singleton)public IReadOnlyList<string> GetExtensionSubtags(String singleton)Public Function GetExtensionSubtags(singleton As String) As IReadOnlyList( Of string )// You can use this method in JavaScript.
- singleton
- PlatForm::String String String String
A single-character subtag for the LanguageTag of the current language. See BCP-47 language tags, Extensions and the Extensions Registry.
The list of extension subtags identified by singleton.
Remarks
If singleton does not exist for the current language, the returned vector is empty.
If singleton is a known system (such as "u", the Unicode extension), the returned subtags may be combined into logical units. For example, "de-DE-u-attr-co-phonebk" returns a vector with two items: "attr" and "co-phonebk". If singleton is unknown, each subtag is returned in a separate item.
- See Also
IsWellFormed(String) IsWellFormed(String) IsWellFormed(String) IsWellFormed(String)
Determines whether a BCP-47 language tag is well-formed.
public : static PlatForm::Boolean IsWellFormed(PlatForm::String languageTag)public static bool IsWellFormed(String languageTag)Public Static Function IsWellFormed(languageTag As String) As bool// You can use this method in JavaScript.
- languageTag
- PlatForm::String String String String
A BCP-47 language tag.
True if the language tag is well-formed as defined by BCP-47, except when the language tag can never be valid according to BCP-47. Otherwise it returns false. If this method returns true, an application can safely construct a language by using this tag. If it returns false, attempting to construct a language for the given tag will throw an exception.
- See Also
TrySetInputMethodLanguageTag(String) TrySetInputMethodLanguageTag(String) TrySetInputMethodLanguageTag(String) TrySetInputMethodLanguageTag(String)
Tries to set the normalized BCP-47 language tag of this language.
public : static PlatForm::Boolean TrySetInputMethodLanguageTag(PlatForm::String languageTag)public static bool TrySetInputMethodLanguageTag(String languageTag)Public Static Function TrySetInputMethodLanguageTag(languageTag As String) As bool// You can use this method in JavaScript.
- languageTag
- PlatForm::String String String String
The normalized BCP-47 language tag.
Starting in : Language tags can support Unicode extensions. See the Remarks for the Language constructor.
true if the value is successfully set, otherwise false.
This method will only attempt to change the input language if the application is running on an IoT device. On non-IoT devices, the return value is always false.
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
| Capabilities |
systemManagement
|