Allow fine grained control over locale
This commit is contained in:
@@ -297,11 +297,19 @@ int main (int argc, char *argv[])
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
/* initialize C and C++ locales to user preference */
|
||||
setlocale (LC_ALL, "");
|
||||
try {
|
||||
std::locale::global (std::locale (setlocale (LC_ALL, 0)));
|
||||
} catch (...) {
|
||||
std::cerr << "Cannot set C++ locale\n";
|
||||
char* l_msg = NULL;
|
||||
char* l_num = NULL;
|
||||
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";
|
||||
}
|
||||
l_msg = setlocale (LC_MESSAGES, NULL);
|
||||
l_num = setlocale (LC_NUMERIC, NULL);
|
||||
if (l_msg) { l_msg = strdup (l_msg); }
|
||||
if (l_num) { l_num = strdup (l_num); }
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -379,6 +387,25 @@ 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;
|
||||
|
||||
@@ -69,6 +69,7 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user