1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-15 00:24:19 +00:00

Clarified documentation for SystemStats::getDisplayLanguage(), to make clear that it may return a multi-part region name. Updated the win32 implementation of this method to include the region code.

This commit is contained in:
jules 2014-05-09 11:40:04 +01:00
parent 2e8b09b3eb
commit 4721d75cc1
2 changed files with 14 additions and 4 deletions

View file

@ -428,8 +428,16 @@ String SystemStats::getDisplayLanguage()
DynamicLibrary dll ("kernel32.dll");
JUCE_LOAD_WINAPI_FUNCTION (dll, GetUserDefaultUILanguage, getUserDefaultUILanguage, LANGID, (void))
if (getUserDefaultUILanguage != nullptr)
return getLocaleValue (MAKELCID (getUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SISO639LANGNAME, "en");
if (getUserDefaultUILanguage == nullptr)
return "en";
return "en";
const DWORD langID = MAKELCID (getUserDefaultUILanguage(), SORT_DEFAULT);
String mainLang (getLocaleValue (langID, LOCALE_SISO639LANGNAME, "en"));
String region (getLocaleValue (langID, LOCALE_SISO3166CTRYNAME, nullptr));
if (region.isNotEmpty())
mainLang << '-' << region;
return mainLang;
}

View file

@ -118,7 +118,9 @@ public:
static String getUserRegion();
/** Returns the user's display language.
The return value is a 2 or 3 letter language code (ISO 639-1 or ISO 639-2)
The return value is a 2 or 3 letter language code (ISO 639-1 or ISO 639-2).
Note that depending on the OS and region, this may also be followed by a dash
and a sub-region code, e.g "en-GB"
*/
static String getDisplayLanguage();