move the check for msgids matching the current language in front of everything else in AddCatalog(): why bother loading catalogs uselessly?

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56766 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-11-14 19:10:10 +00:00
parent 6f0114437c
commit a343fe63e8

View File

@@ -2575,6 +2575,14 @@ bool wxLocale::AddCatalog(const wxString& szDomain,
{ {
wxCHECK_MSG( IsOk(), false, "must initialize catalog first" ); wxCHECK_MSG( IsOk(), false, "must initialize catalog first" );
// 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 ( msgIdLanguage == m_language )
return true;
wxMsgCatalog *pMsgCat = new wxMsgCatalog; wxMsgCatalog *pMsgCat = new wxMsgCatalog;
if ( pMsgCat->Load(m_strShort, szDomain, msgIdCharset, m_bConvertEncoding) ) if ( pMsgCat->Load(m_strShort, szDomain, msgIdCharset, m_bConvertEncoding) )
@@ -2591,12 +2599,6 @@ bool wxLocale::AddCatalog(const wxString& szDomain,
delete pMsgCat; delete pMsgCat;
// 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 ( msgIdLanguage == m_language )
return true;
// If there's no exact match, we may still get partial match where the // If there's no exact match, we may still get partial match where the
// (basic) language is same, but the country differs. For example, it's // (basic) language is same, but the country differs. For example, it's
// permitted to use en_US strings from sources even if m_language is en_GB: // permitted to use en_US strings from sources even if m_language is en_GB: