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.
This commit is contained in:
committed by
Vadim Zeitlin
parent
b0eca3bdde
commit
14e905858d
@@ -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;
|
||||
|
Reference in New Issue
Block a user