Try loading even English translations if provided.
Doing so has negligible cost and can be useful in some situations (e.g. when using symbolic msgids despite gettext best practices). Patch by tmsorensen. Fixes #15522. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74849 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ac687ddffb
commit
a255c995a1
@ -169,7 +169,7 @@ public:
|
||||
|
||||
private:
|
||||
// perform loading of the catalog via m_loader
|
||||
bool LoadCatalog(const wxString& domain, const wxString& lang);
|
||||
bool LoadCatalog(const wxString& domain, const wxString& lang, const wxString& msgIdLang);
|
||||
|
||||
// find catalog by name in a linked list, return NULL if !found
|
||||
wxMsgCatalog *FindCatalog(const wxString& domain) const;
|
||||
|
@ -1506,17 +1506,11 @@ bool wxTranslations::AddCatalog(const wxString& domain,
|
||||
wxS("adding '%s' translation for domain '%s' (msgid language '%s')"),
|
||||
domain_lang, domain, msgIdLang);
|
||||
|
||||
// It is OK to not load catalog if the msgid language and m_language match,
|
||||
// in which case we can directly display the texts embedded in program's
|
||||
// source code:
|
||||
if ( msgIdLang == domain_lang )
|
||||
return true;
|
||||
|
||||
return LoadCatalog(domain, domain_lang);
|
||||
return LoadCatalog(domain, domain_lang, msgIdLang);
|
||||
}
|
||||
|
||||
|
||||
bool wxTranslations::LoadCatalog(const wxString& domain, const wxString& lang)
|
||||
bool wxTranslations::LoadCatalog(const wxString& domain, const wxString& lang, const wxString& msgIdLang)
|
||||
{
|
||||
wxCHECK_MSG( m_loader, false, "loader can't be NULL" );
|
||||
|
||||
@ -1553,6 +1547,15 @@ bool wxTranslations::LoadCatalog(const wxString& domain, const wxString& lang)
|
||||
cat = m_loader->LoadCatalog(domain, baselang);
|
||||
}
|
||||
|
||||
if ( !cat )
|
||||
{
|
||||
// It is OK to not load catalog if the msgid language and m_language match,
|
||||
// in which case we can directly display the texts embedded in program's
|
||||
// source code:
|
||||
if ( msgIdLang == lang )
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( cat )
|
||||
{
|
||||
// add it to the head of the list so that in GetString it will
|
||||
|
Loading…
Reference in New Issue
Block a user