Skip to main content
Retrieve the locale of the signed-in session with GetUserDefaultLocaleName:
Games usually don’t care about the exact locale — they care about which language resources to load. Pick the language in the game’s package that is “closest” to what the user selected. Three inputs matter:
  1. Languages declared in MicrosoftGame.config.
  2. Languages declared in the package layout file.
  3. Language selected on the device.
Use XPackageGetUserLocale to always get the closest supported language:

Examples

1. User locale matches a supported resource

User selects French / France (fr-FR). MicrosoftGame.config:
  • XPackageGetUserLocale returns fr-FR.
  • GetUserDefaultLocaleName returns fr-FR.

2. User locale not in manifest, but same language exists

User selects English / UK (en-GB). MicrosoftGame.config:
  • XPackageGetUserLocale returns en-US (fallback within same language).
  • GetUserDefaultLocaleName returns en-GB (always the console value).

3. User language not present at all

User locale is fr-FR. MicrosoftGame.config:
  • XPackageGetUserLocale returns en-US (first entry in Resources).
  • GetUserDefaultLocaleName returns fr-FR.

Summary

  • GetUserDefaultLocaleName — what the console is set to, ignoring the game’s declared languages.
  • XPackageGetUserLocale — which language to load, using this logic:
    1. If user’s locale is in MicrosoftGame.config, return it.
    2. Otherwise find a same-language locale in the manifest (best fallback based on user’s locale).
    3. Otherwise return the first locale in Resources.
    4. If no languages are listed, return the console language.

See also

Last modified on August 20, 2026