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" );
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
}
-const wxString& wxTranslations::GetString(const wxString& origString,
- const wxString& domain) const
+const wxString *wxTranslations::GetTranslatedString(const wxString& origString,
+ const wxString& domain) const
{
- return GetString(origString, origString, UINT_MAX, domain);
+ return GetTranslatedString(origString, UINT_MAX, domain);
}
-const wxString& wxTranslations::GetString(const wxString& origString,
- const wxString& origString2,
- unsigned n,
- const wxString& domain) const
+const wxString *wxTranslations::GetTranslatedString(const wxString& origString,
+ unsigned n,
+ const wxString& domain) const
{
if ( origString.empty() )
- return GetUntranslatedString(origString);
+ return NULL;
const wxString *trans = NULL;
wxMsgCatalog *pMsgCat;
(!domain.empty() ? wxString::Format("domain '%s' ", domain) : wxString()),
m_lang
);
-
- if (n == UINT_MAX)
- return GetUntranslatedString(origString);
- else
- return GetUntranslatedString(n == 1 ? origString : origString2);
}
- return *trans;
+ return trans;
}