Specifies the language-related preferences that the app can use and maintain.
public : static class ApplicationLanguages
static struct winrt::Windows::Globalization::ApplicationLanguages
public static class ApplicationLanguages
Public Shared Class ApplicationLanguages
// This class does not provide a public constructor.
Windows 10 (introduced v10.0.10240.0)
Windows.Foundation.UniversalApiContract (introduced v1)
The languages referenced in this class are represented by BCP-47 language tags. Each of these is a language identifier and not a locale name, although the two structurally can be the same. As a language tag, "en-US" means American English (or the dialect of English spoken in the United States). It makes no claims about the actual location of the speakers (though many of them do reside in the US) and no other claims about conventions that are used in the US such as the measurement system or currency.
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "en-US"
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.
UWP apps can be deployed using resource packages. When language resource packages are used, the packages that are installed and registered for a given user are determined by the languages in the user's language profile. As a result, not all of the languages included in the app bundle that was submitted to the Microsoft Store will necessarily be available for use at runtime. The PrimaryLanguageOverride property should only be set to languages that are available for the user.
The languages available for the app to use as an ApplicationLanguages object at runtime are limited to those languages included in the main app package manifest and the languages corresponding to language resource packages that are applicable for the user (determined by matching languages in the user's preferences), and that are installed and registered for the user. The ApplicationLanguages.ManifestLanguages property reflects language resource packs that are available for the user, and hence returns an appropriate set of languages that can be used for setting the PrimaryLanguageOverride property.
The ApplicationLanguages.Languages property will return a very similar list to the ManifestLanguages property. It may differ in including regional language variations not listed in any package manifest; for example, "en-CA" (English (Canada)) can be returned by the Languages property if the user has "en-CA" in their profile and the app supports any regional variety of English. Such user-derived regional language variations can be preferable for setting the PrimaryLanguageOverride property since the app will then provide globalization behaviors more appropriate for the user.
If a language is in the main app package but is not a match for any language in the user's preference, it is returned by the ManifestLanguages property but not the Languages property. These can also be used for setting the PrimaryLanguageOverride property. However, since these languages are not reflected in the user's preferences, the user might not understand those languages. Such settings should be used only when chosen directly by the user.
|Languages Languages Languages Languages Languages||
Gets the ranked list of current runtime language values preferred by the user.
|ManifestLanguages ManifestLanguages ManifestLanguages ManifestLanguages ManifestLanguages||
Gets the app's declared list of supported languages.
|PrimaryLanguageOverride PrimaryLanguageOverride PrimaryLanguageOverride PrimaryLanguageOverride PrimaryLanguageOverride||
Gets or sets an override for the app's preferred language, expressed as a BCP-47 language tag. This setting is persisted.
|GetLanguagesForUser(User) GetLanguagesForUser(User) GetLanguagesForUser(User) GetLanguagesForUser(User) GetLanguagesForUser(User)||
Retrieves the language preferences of the specified user. This API is part of support for multi-user apps (MUA).