// this is a bit strange as under Windows we get the encoding name using its
// numeric value and under Unix we do it the other way round, but this just
-// reflects the way different systems provide he encoding info
+// reflects the way different systems provide the encoding info
/* static */
wxString wxLocale::GetSystemEncodingName()
// ISO-646, i.e. 7 bit ASCII
//
// and recent glibc call it ANSI_X3.4-1968...
- if ( strcmp(alang, "646") == 0 ||
- strcmp(alang, "ANSI_X3.4-1968") == 0 )
+ //
+ // HP-UX uses HP-Roman8 cset which is not the same as ASCII (see RFC
+ // 1345 for its definition) but must be recognized as otherwise HP
+ // users get a warning about it on each program startup, so handle it
+ // here -- but it would be obviously better to add real supprot to it,
+ // of course!
+ if ( strcmp(alang, "646") == 0
+ || strcmp(alang, "ANSI_X3.4-1968") == 0
+#ifdef __HPUX__
+ || strcmp(alang, "roman8") == 0
+#endif // __HPUX__
+ )
{
encname = _T("US-ASCII");
}
{
CreateLanguagesDB();
+ // calling GetLanguageInfo(wxLANGUAGE_DEFAULT) is a natural thing to do, so
+ // make it work
+ if ( lang == wxLANGUAGE_DEFAULT )
+ lang = GetSystemLanguage();
+
const size_t count = ms_languagesDB->GetCount();
for ( size_t i = 0; i < count; i++ )
{
return pszTrans;
}
+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(wxT(""), (size_t)-1);
+ }
+ else
+ {
+ // search in all domains
+ for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext )
+ {
+ pszTrans = pMsgCat->GetString(wxT(""), (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;
+}
+
+
// find catalog by name in a linked list, return NULL if !found
wxMsgCatalog *wxLocale::FindCatalog(const wxChar *szDomain) const
{