Skip to content

Commit

Permalink
Revert "MultiLangMgr::getOSUserLanguage (): get rid of special window…
Browse files Browse the repository at this point in the history
…s code"

This reverts commit 562ed3b.
  • Loading branch information
heckflosse committed Jan 4, 2019
1 parent d43ccc5 commit de6ee45
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions rtgui/multilangmgr.cc
Expand Up @@ -209,6 +209,27 @@ Glib::ustring MultiLangMgr::getOSUserLanguage ()
{
Glib::ustring langName ("default");

#if defined (WIN32)

const LCID localeID = GetUserDefaultLCID ();
TCHAR localeName[18];

const int langLen = GetLocaleInfo (localeID, LOCALE_SISO639LANGNAME, localeName, 9);
if (langLen <= 0) {
return langName;
}

localeName[langLen - 1] = '-';

const int countryLen = GetLocaleInfo (localeID, LOCALE_SISO3166CTRYNAME, &localeName[langLen], 9);
if (countryLen <= 0) {
return langName;
}

langName = localeToLang (localeName);

#elif defined (__linux__) || defined (__APPLE__)

// Query the current locale and force decimal point to dot.
const char *locale = getenv("LANG");
if (locale || (locale = setlocale (LC_CTYPE, ""))) {
Expand All @@ -217,5 +238,7 @@ Glib::ustring MultiLangMgr::getOSUserLanguage ()

setlocale (LC_NUMERIC, "C");

#endif

return langName;
}

0 comments on commit de6ee45

Please sign in to comment.