wxLocal::AddCatalog not working in 3.1.2.? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Super wx Problem Solver
Super wx Problem Solver
Posts: 374
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

wxLocal::AddCatalog not working in 3.1.2.?

Post by mael15 » Wed Sep 04, 2019 8:07 am


I recently upgraded to wxWidgets 3.1.2. and some code that worked before does not anymore. I did not change that code for a long time:

Code: Select all

bool wxTranslationHelperCustom::applyNewDocuLanguage(wxLanguage selLang)
	if (GetDocuLocale() && (wxLanguage)GetDocuLocale()->GetLanguage() == selLang)
		return false;

	wxString oldLang = GetDocuLocale() ? GetDocuLocale()->GetCanonicalName() : wxT("nix");
	if (GetDocuLocale())
		delete GetDocuLocale();
	documentationLocale = new wxLocale;
	bool ok = GetDocuLocale()->Init(selLang);
	bool success = GetDocuLocale()->AddCatalog(appName, selLang, selLang != wxLANGUAGE_ENGLISH ? wxT("iso-8859-1") : wxT("UTF-8"));
	OutputDebugString(wxString::Format(wxT("new language selected: %s -> %s (Success: %s)\n"), oldLang, GetDocuLocale()->GetCanonicalName(), success ? wxT("yes") : wxT("no")));
	return true;
"success" is false from translation.cpp line 1581 with this comment that I do not understand:
// No use loading languages that are less preferred than the
// msgid language, as by definition it contains all the strings
// in the msgid language.
What could keep the Catalog from being loaded?

Part Of The Furniture
Part Of The Furniture
Posts: 2024
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxLocal::AddCatalog not working in 3.1.2.?

Post by PB » Wed Sep 04, 2019 8:30 am

There is a bug related to this, that sneaked into 3.1.2 right before its release. It has been fixed in the master
https://github.com/wxWidgets/wxWidgets/ ... c151e73375

Post Reply