From d4f91010c37a3ce185bb3c8bcf6453503eccd2b2 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 20 Apr 2017 22:12:18 +0200 Subject: 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. --- gtk2_ardour/main.cc | 36 +----------------------------------- gtk2_ardour/rc_option_editor.cc | 17 ----------------- gtk2_ardour/rc_option_editor.h | 1 - gtk2_ardour/ui_config_vars.h | 1 - 4 files changed, 1 insertion(+), 54 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; diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 674ec2c88a..84034ae633 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -2296,19 +2296,6 @@ RCOptionEditor::RCOptionEditor () add_option (_("General/Translation"), bo); - _l10n = new ComboOption ( - "locale-mode", - _("Localization"), - sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_locale_mode), - sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_locale_mode) - ); - - _l10n->add (ARDOUR::SET_LC_ALL, _("Set complete locale")); - _l10n->add (ARDOUR::SET_LC_MESSAGES, _("Enable only message translation")); - _l10n->add (ARDOUR::SET_LC_MESSAGES_AND_LC_NUMERIC, _("Translate messages and format numeric format")); - _l10n->set_note (_("This setting is provided for plugin compatibility. e.g. some plugins on some systems expect the decimal point to be a dot.")); - - add_option (_("General/Translation"), _l10n); parameter_changed ("enable-translation"); #endif // ENABLE_NLS @@ -3971,10 +3958,6 @@ RCOptionEditor::parameter_changed (string const & p) } else if (p == "open-gui-after-adding-plugin" || p == "show-inline-display-by-default") { #if (defined LV2_SUPPORT && defined LV2_EXTENDED) _plugin_prefer_inline->set_sensitive (UIConfiguration::instance().get_open_gui_after_adding_plugin() && UIConfiguration::instance().get_show_inline_display_by_default()); -#endif -#ifdef ENABLE_NLS - } else if (p == "enable-translation") { - _l10n->set_sensitive (ARDOUR::translations_are_enabled ()); #endif } } diff --git a/gtk2_ardour/rc_option_editor.h b/gtk2_ardour/rc_option_editor.h index e0d0116c36..d6c5bed4a7 100644 --- a/gtk2_ardour/rc_option_editor.h +++ b/gtk2_ardour/rc_option_editor.h @@ -60,7 +60,6 @@ private: Gtk::Adjustment* _ltc_volume_adjustment; BoolOption* _ltc_send_continuously; BoolOption* _plugin_prefer_inline; - ComboOption* _l10n; PBD::ScopedConnection parameter_change_connection; PBD::ScopedConnection engine_started_connection; diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 53a02865a7..ae94452c96 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -70,7 +70,6 @@ UI_CONFIG_VARIABLE (float, meter_hold, "meter-hold", 100.0f) UI_CONFIG_VARIABLE (ARDOUR::VUMeterStandard, meter_vu_standard, "meter-vu-standard", ARDOUR::MeteringVUstandard) UI_CONFIG_VARIABLE (ARDOUR::MeterLineUp, meter_line_up_level, "meter-line-up-level", ARDOUR::MeteringLineUp18) UI_CONFIG_VARIABLE (ARDOUR::MeterLineUp, meter_line_up_din, "meter-line-up-din", ARDOUR::MeteringLineUp15) -UI_CONFIG_VARIABLE (ARDOUR::LocaleMode, locale_mode, "locale-mode", ARDOUR::SET_LC_ALL) UI_CONFIG_VARIABLE (float, meter_peak, "meter-peak", 0.0f) UI_CONFIG_VARIABLE (bool, meter_style_led, "meter-style-led", false) UI_CONFIG_VARIABLE (bool, show_editor_meter, "show-editor-meter", true) -- cgit v1.2.3