From 3417c8e48bf635b68e5ff08b317af273b5fdb396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 30 May 2021 17:03:31 +0200 Subject: [PATCH] Fix passing of default language to wxTranslations wxTranslations needs the information that user's default language is used; in particular, it may choose to use a cascade of user-preferred languages to choose the best UI language. This was accidentally broken by 18bf718f607ad0f11a5e4c5e48916d73c50a16a0 which changed the logic to fill shortName from the builtin database. This consequently changed wxTranslations to use only the single detected language and ignore user's preference cascade. Closes https://github.com/wxWidgets/wxWidgets/pull/2385 --- src/common/intl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/intl.cpp b/src/common/intl.cpp index fbead9f5d2..6dc41e4b05 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -615,7 +615,9 @@ bool wxLocale::Init(int lang, int flags) ( retloc != NULL, name, - shortName, + // wxLANGUAGE_DEFAULT needs to be passed to wxTranslations as "" + // for correct detection of user's preferred language(s) + lang == wxLANGUAGE_DEFAULT ? wxString() : shortName, flags & wxLOCALE_LOAD_DEFAULT ); #else // !(__UNIX__ || __WIN32__)