XPackageGetUserLocale
Gets the current user locale.Syntax
Parameters
localeSize _In_Type: size_t On success, the size of the string in locale. locale _Out_writes_(localeSize)
Type: char* On success, contains the user locale.
Return value
Type: HRESULT HRESULT success or error code.Remarks
This function isn’t safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.
locale. If the package locale matches an installed user locale, the function succeeds and returns the user locale in locale. If the package locale does not exactly match an installed user locale, the function attempts to find the closest matching installed user locale. If the function cannot find a close match, an error occurs; otherwise, the function succeeds and the closest matching installed user locale is returned in locale.
If you are using Intelligent Delivery to control which languages are installed for your game, it’s possible that the locale to which the user has set the console has chunks that are not currently installed. This requires a game to always verify that the necessary chunks are installed, and to fall back to another language if they are not: a procedure that requires considerable knowledge about locales and how they fall back to their closest languages. This function provides a way to get the current user locale, or the closest matching fallback, without the need to implement your own locale analysis and fallback procedure.
The following code sample demonstrates how to use this function.
Requirements
Header: XPackage.h Library: xgameruntime.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consolesConceptual documentation
- Intelligent Delivery: language specifiers
- Time-sensitive threads
- Determining console locale and language
See also
XPackageStreaming Installation and Intelligent Delivery
