From 14e905858d0c30b03914457f9fb5c49173366cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20S=C5=82odkowicz?= Date: Mon, 17 Dec 2018 02:39:06 +0100 Subject: [PATCH] Fix regression in wxTranslations::AddCatalog() Do load the catalog corresponding to the language of "msgid" strings in the source code, only skip the languages strictly less preferred than it. This avoids incompatibilities with pre-3.1.2 behaviour and avoids breaking existing applications relying on the old behaviour. Closes https://github.com/wxWidgets/wxWidgets/pull/1081 Closes #18297. --- docs/changes.txt | 4 ++++ src/common/translation.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index fc7fcb1e00..c3d49daf94 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -108,6 +108,10 @@ Changes in behaviour which may result in build errors 3.1.3: (released 2019-??-??) ---------------------------- +All: + +- Fix regression in wxTranslations::AddCatalog() in 3.1.2 (Tomasz Słodkowicz). + All (GUI): - Fix wxInfoBar close button size in high DPI (Stefan Ziegler). diff --git a/src/common/translation.cpp b/src/common/translation.cpp index 7d9937cd18..26515b4c9b 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -1574,18 +1574,18 @@ bool wxTranslations::AddCatalog(const wxString& domain, wxS("adding '%s' translation for domain '%s' (msgid language '%s')"), *lang, domain, msgIdLang); - // No use loading languages that are less preferred than the - // msgid language, as by definition it contains all the strings - // in the msgid language. - if ( msgIdLang == *lang ) - break; - // We determine success by the success of loading/failing to load // the most preferred (i.e. the first one) language's catalog: if ( lang == domain_langs.begin() ) success = LoadCatalog(domain, *lang, msgIdLang); else LoadCatalog(domain, *lang, msgIdLang); + + // No use loading languages that are less preferred than the + // msgid language, as by definition it contains all the strings + // in the msgid language. + if ( msgIdLang == *lang ) + break; } return success;