As always, when troubleshooting wxTranslation issues, I recommend calling
before initializing locale, obviously using debug build of wxWidgets. This will make wxWidgets output a lot of information about what is going on under the hood with translations and should make it possible to find out where it goes wrong. In particular, it shows what paths are searched for the message catalogs.
If you are using Code::Blocks, it unfortunately does not show output of wxLogDebug/Trace() calls and the program needs to be run under gdb directly.
For example, running this (where the message catalogs are not present)
Code: Select all
#include <wx/wx.h>
#include <wx/intl.h>
class MyApp : public wxApp
{
wxLocale m_locale;
public:
bool OnInit() override
{
wxLog::AddTraceMask("i18n");
m_locale.Init();
m_locale.AddCatalog("wxstd");
m_locale.AddCatalog("test");
wxLogMessage(_("Test"));
return false;
}
}; wxIMPLEMENT_APP(MyApp);
produces this
Code: Select all
warning: (i18n) adding 'en_US' translation for domain 'wxstd-3.1' (msgid language 'en_US')
warning: (i18n) looking for "wxstd-3.1.mo" in search path:
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US.WINDOWS-1252\LC_MESSAGES
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US.WINDOWS-1252
warning: (i18n)
warning: (i18n) looking for "wxstd-3.1.mo" in search path:
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US\LC_MESSAGES
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US
warning: (i18n)
warning: (i18n) looking for "wxstd-3.1.mo" in search path:
warning: (i18n) c:\dev\cb-tests\test200s\bin\en\LC_MESSAGES
warning: (i18n) c:\dev\cb-tests\test200s\bin\en
warning: (i18n)
warning: (i18n) adding 'en_US' translation for domain 'wxstd' (msgid language 'en_US')
warning: (i18n) looking for "wxstd.mo" in search path:
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US.WINDOWS-1252\LC_MESSAGES
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US.WINDOWS-1252
warning: (i18n)
warning: (i18n) looking for "wxstd.mo" in search path:
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US\LC_MESSAGES
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US
warning: (i18n)
warning: (i18n) looking for "wxstd.mo" in search path:
warning: (i18n) c:\dev\cb-tests\test200s\bin\en\LC_MESSAGES
warning: (i18n) c:\dev\cb-tests\test200s\bin\en
warning: (i18n)
warning: (i18n) adding 'en_US' translation for domain 'test' (msgid language 'en_US')
warning: (i18n) looking for "test.mo" in search path:
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US.WINDOWS-1252\LC_MESSAGES
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US.WINDOWS-1252
warning: (i18n)
warning: (i18n) looking for "test.mo" in search path:
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US\LC_MESSAGES
warning: (i18n) c:\dev\cb-tests\test200s\bin\en_US
warning: (i18n)
warning: (i18n) looking for "test.mo" in search path:
warning: (i18n) c:\dev\cb-tests\test200s\bin\en\LC_MESSAGES
warning: (i18n) c:\dev\cb-tests\test200s\bin\en
warning: (i18n)
warning: (i18n) string "Test" not found in locale 'en_US'.
warning: (i18n) string "%s Information" not found in locale 'en_US'.
warning: (i18n) string "Yes" not found in locale 'en_US'.
warning: (i18n) string "No" not found in locale 'en_US'.
warning: (i18n) string "OK" not found in locale 'en_US'.
warning: (i18n) string "Cancel" not found in locale 'en_US'.
warning: (i18n) string "Help" not found in locale 'en_US'.
warning: (i18n) string "OK" not found in locale 'en_US'.