GetUserDefaultLocaleName:
- Languages declared in
MicrosoftGame.config. - Languages declared in the package layout file.
- Language selected on the device.
XPackageGetUserLocale to always get the closest supported language:
Examples
1. User locale matches a supported resource
User selects French / France (fr-FR).MicrosoftGame.config:
XPackageGetUserLocalereturnsfr-FR.GetUserDefaultLocaleNamereturnsfr-FR.
2. User locale not in manifest, but same language exists
User selects English / UK (en-GB).MicrosoftGame.config:
XPackageGetUserLocalereturnsen-US(fallback within same language).GetUserDefaultLocaleNamereturnsen-GB(always the console value).
3. User language not present at all
User locale isfr-FR. MicrosoftGame.config:
XPackageGetUserLocalereturnsen-US(first entry inResources).GetUserDefaultLocaleNamereturnsfr-FR.
Summary
GetUserDefaultLocaleName— what the console is set to, ignoring the game’s declared languages.XPackageGetUserLocale— which language to load, using this logic:- If user’s locale is in
MicrosoftGame.config, return it. - Otherwise find a same-language locale in the manifest (best fallback based on user’s locale).
- Otherwise return the first locale in
Resources. - If no languages are listed, return the console language.
- If user’s locale is in
See also
Related API documentation
- XGameRuntime features reference —
XGameRuntimeLocalefor the active locale - XPackage API reference — locale-aware package resource queries
