From de6ee457e6eaee984a1185c111d81cdebb62a608 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Fri, 4 Jan 2019 14:02:24 +0100 Subject: [PATCH] Revert "MultiLangMgr::getOSUserLanguage (): get rid of special windows code" This reverts commit 562ed3b22a964b6561fcb2bc18dd5a0322a580ce. --- rtgui/multilangmgr.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/rtgui/multilangmgr.cc b/rtgui/multilangmgr.cc index a439c0602a..8d2985436a 100644 --- a/rtgui/multilangmgr.cc +++ b/rtgui/multilangmgr.cc @@ -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, ""))) { @@ -217,5 +238,7 @@ Glib::ustring MultiLangMgr::getOSUserLanguage () setlocale (LC_NUMERIC, "C"); +#endif + return langName; }