Reputation: 139
What is the proper way in standard C++ to query the preferred user language, e.g. en_US?
The Win32 API includes a beautifully named function GetUserDefaultUILanguage
that does exactly this, but I want to be cross-platform and do it with facilities provides by the standard C++ library.
Upvotes: 1
Views: 284
Reputation: 63775
std::locale
is a very similar standard library construct, where constructing it with an empty string produces what's believed to be the user's preferred locale.
std::locale("").name()
, for example, might produce en_US.UTF8
Upvotes: 2