summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-05-23 23:27:48 +0200
committerCarl Hetherington <cth@carlh.net>2025-05-24 00:44:18 +0200
commit2aea5e99b0fc774d8539feac92224ca1caa823c7 (patch)
tree3fb9cf13c11693fef43adc4542592c65c64eac14
parent354cf55bb0e8e70d4c9f40c91ae3f89e7922da01 (diff)
Fix wx i18n code.
-rw-r--r--src/wx/wx_util.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 3e5dd7b76..ed1513ceb 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -40,6 +40,7 @@
#include "lib/version.h"
#include <dcp/locale_convert.h>
#include <dcp/warnings.h>
+#include <fmt/format.h>
LIBDCP_DISABLE_WARNINGS
#include <wx/display.h>
#include <wx/filepicker.h>
@@ -443,9 +444,12 @@ dcpomatic_setup_i18n()
auto translations = new wxTranslations();
+ string lib_lang;
+
auto config_lang = Config::instance()->language();
if (config_lang && !config_lang->empty()) {
translations->SetLanguage(std_to_wx(*config_lang));
+ lib_lang = *config_lang;
} else {
/* We want to use the user's preferred language. It seems that if we use the wxWidgets default we will get the
* language for the locale, which may not be what we want (e.g. for a machine in Germany, configured for DE locale,
@@ -455,11 +459,11 @@ dcpomatic_setup_i18n()
* which wxTranslations::SetLanguage will accept.
*/
auto const language_code = get_locale_value(kCFLocaleLanguageCode);
+ lib_lang = fmt::format("{}_{}", language_code, get_locale_value(kCFLocaleCountryCode));
/* Ideally this would be wxUILocale (as wxLocale is deprecated) but we want to keep this building
* with the old wxWidgets we use for the older macOS builds.
*/
- auto const info = wxLocale::FindLanguageInfo(std_to_wx(language_code));
- if (info) {
+ if (auto const info = wxLocale::FindLanguageInfo(std_to_wx(language_code))) {
#if wxCHECK_VERSION(3, 1, 6)
translations->SetLanguage(info->GetCanonicalWithRegion());
#else
@@ -488,7 +492,7 @@ dcpomatic_setup_i18n()
wxTranslations::Set(translations);
- dcpomatic_setup_c_and_gettext_i18n(config_lang.get_value_or(""));
+ dcpomatic_setup_c_and_gettext_i18n(lib_lang);
}
#else