+wxString wxLocale::GetHeaderValue( const wxChar* szHeader,
+ const wxChar* szDomain ) const
+{
+ if ( wxIsEmpty(szHeader) )
+ return wxEmptyString;
+
+ wxChar const * pszTrans = NULL;
+ wxMsgCatalog *pMsgCat;
+
+ if ( szDomain != NULL )
+ {
+ pMsgCat = FindCatalog(szDomain);
+
+ // does the catalog exist?
+ if ( pMsgCat == NULL )
+ return wxEmptyString;
+
+ pszTrans = pMsgCat->GetString(wxEmptyString, (size_t)-1);
+ }
+ else
+ {
+ // search in all domains
+ for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext )
+ {
+ pszTrans = pMsgCat->GetString(wxEmptyString, (size_t)-1);
+ if ( pszTrans != NULL ) // take the first found
+ break;
+ }
+ }
+
+ if ( wxIsEmpty(pszTrans) )
+ return wxEmptyString;
+
+ wxChar const * pszFound = wxStrstr(pszTrans, szHeader);
+ if ( pszFound == NULL )
+ return wxEmptyString;
+
+ pszFound += wxStrlen(szHeader) + 2 /* ': ' */;
+
+ // Every header is separated by \n
+
+ wxChar const * pszEndLine = wxStrchr(pszFound, wxT('\n'));
+ if ( pszEndLine == NULL ) pszEndLine = pszFound + wxStrlen(pszFound);
+
+
+ // wxString( wxChar*, length);
+ wxString retVal( pszFound, pszEndLine - pszFound );
+
+ return retVal;
+}
+
+