summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-02-10 20:55:51 +0100
committerCarl Hetherington <cth@carlh.net>2025-02-10 23:48:40 +0100
commitb221a61217e5e8d18afc50d32c495391c07100d8 (patch)
tree4da708adddd412015f49dbee5e45d2ed53740829
parentfa580d756b32cd46f735cbbdabc9218bb8df2560 (diff)
Fix macOS locale handling.
The docs for wxLocale say it's broken on macOS, and it seems to cause problems when e.g. de_DE is configured in DoM and the computer is set to de_DE locale (and language) - then you can't enter , in wxSpinCtrlDouble and if you type a . and then use the up/down buttons it all goes wrong. It doesn't seem possible to set a configured locale in DoM, but you probably don't want that anyway. wxUILocale::UseDefault() appears to magically fix everything. Unfortunately this is not available in the version of wxWidgets we use for 10.8 and 10.9, and we can't go higher with wxWidgets on those macOS versions. So maybe localisation on 10.{8,9} will be broken, and stay broken.
-rw-r--r--src/wx/wx_util.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 78fa3f544..1e385c63c 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -47,6 +47,9 @@ LIBDCP_DISABLE_WARNINGS
#include <wx/sizer.h>
#include <wx/spinctrl.h>
#include <wx/splash.h>
+#if wxCHECK_VERSION(3, 1, 6)
+#include <wx/uilocale.h>
+#endif
LIBDCP_ENABLE_WARNINGS
#include <boost/thread.hpp>
@@ -425,6 +428,10 @@ dcpomatic_setup_i18n()
{
wxLog::EnableLogging();
+#if wxCHECK_VERSION(3, 1, 6)
+ wxUILocale::UseDefault();
+#endif
+
auto get_locale_value = [](CFLocaleKey key) {
CFLocaleRef cflocale = CFLocaleCopyCurrent();
auto value = (CFStringRef) CFLocaleGetValue(cflocale, key);