diff options
author | Robin Gareus <robin@gareus.org> | 2017-04-20 22:12:18 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-04-20 22:12:18 +0200 |
commit | d4f91010c37a3ce185bb3c8bcf6453503eccd2b2 (patch) | |
tree | a8f0ae9bea5136efe828334185c0e07568d69f77 /gtk2_ardour/main.cc | |
parent | 9218ccb3b2717d58a98c098fc6810f5bf39999f2 (diff) |
Do not set C++ locale.
Ardour translations and GUI string formatting only depends on the C locale.
Modifying the C++ locale may produce erratic results on various systems
(in particular OSX and macOS) and cause incompatibilies with plugins.
Diffstat (limited to 'gtk2_ardour/main.cc')
-rw-r--r-- | gtk2_ardour/main.cc | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index 3d4e2da20f..10c9c306e7 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -304,24 +304,9 @@ int main (int argc, char *argv[]) #endif #ifdef ENABLE_NLS - /* initialize C and C++ locales to user preference */ - char* l_msg = NULL; - char* l_num = NULL; + /* initialize C locale to user preference */ if (ARDOUR::translations_are_enabled ()) { setlocale (LC_ALL, ""); - try { - std::locale::global (std::locale (setlocale (LC_ALL, 0))); - } catch (...) { - std::cerr << "Cannot set C++ locale\n"; - } -#ifndef COMPILER_MSVC - // LC_MESSAGES isn't a supported locale setting when building - // with MSVC (in fact, I doubt if it's valid for Windows at all) - l_msg = setlocale (LC_MESSAGES, NULL); -#endif - l_num = setlocale (LC_NUMERIC, NULL); - if (l_msg) { l_msg = strdup (l_msg); } - if (l_num) { l_num = strdup (l_num); } } #endif @@ -399,25 +384,6 @@ int main (int argc, char *argv[]) return curvetest (curvetest_file); } -#ifdef ENABLE_NLS - ARDOUR::LocaleMode locale_mode = UIConfiguration::instance().get_locale_mode (); - if (l_msg && l_num && locale_mode != ARDOUR::SET_LC_ALL) { - try { - std::locale cpp_locale (std::locale::classic ()); - cpp_locale = std::locale (cpp_locale, l_msg, std::locale::messages); - if (ARDOUR::SET_LC_MESSAGES_AND_LC_NUMERIC == locale_mode) { - cpp_locale = std::locale (cpp_locale, l_num, std::locale::numeric); - } - std::locale::global (cpp_locale); - } catch (...) { - std::cerr << "Cannot override C++ locale\n"; - } - info << "LC_ALL: " << setlocale (LC_ALL, NULL) << endmsg; - } - free (l_msg); - free (l_num); -#endif - #ifndef PLATFORM_WINDOWS if (::signal (SIGPIPE, sigpipe_handler)) { cerr << _("Cannot xinstall SIGPIPE error handler") << endl; |