]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/intl.cpp
refactored code to create hidden window in one place only; use it from wxTimer; unreg...
[wxWidgets.git] / src / common / intl.cpp
index aef903c92b6b1562096842fa75e2e75d20a3e4d6..b872663c75ee3108fe8496bc11913e76c5b9aa57 100644 (file)
@@ -17,7 +17,7 @@
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
     #pragma implementation "intl.h"
 #endif
 
@@ -513,6 +513,7 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash, bool convertEncoding) cons
         }
     }
 #endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T
+    (void)convertEncoding; // get rid of warnings about unused parameter
 }
 
 wxString wxMsgCatalogFile::GetCharset() const
@@ -647,7 +648,9 @@ bool wxLocale::Init(const wxChar *szName,
   // TODO: how to find languageId
   // SetLocaleInfo(languageId, SORT_DEFAULT, localeName);
 #else
-  m_pszOldLocale = wxStrdup(wxSetlocale(LC_ALL, szLocale));
+  m_pszOldLocale = wxSetlocale(LC_ALL, szLocale);
+  if ( m_pszOldLocale )
+      m_pszOldLocale = wxStrdup(m_pszOldLocale);
 #endif
 
   if ( m_pszOldLocale == NULL )
@@ -683,11 +686,27 @@ bool wxLocale::Init(const wxChar *szName,
 static wxWCharBuffer wxSetlocaleTryUTF(int c, const wxChar *lc)
 {
     wxMB2WXbuf l = wxSetlocale(c, lc);
-    if ( lc && lc[0] != 0 && !l )
+    if ( !l && lc && lc[0] != 0 )
     {
        wxString buf(lc);
-       buf += wxT(".utf8");
-       l = wxSetlocale(c, buf.c_str());
+        wxString buf2;
+       buf2 = buf + wxT(".UTF-8");
+       l = wxSetlocale(c, buf2.c_str());
+        if ( !l )
+        {
+            buf2 = buf + wxT(".utf-8");
+           l = wxSetlocale(c, buf2.c_str());
+        }
+        if ( !l )
+        {
+            buf2 = buf + wxT(".UTF8");
+           l = wxSetlocale(c, buf2.c_str());
+        }
+        if ( !l )
+        {
+            buf2 = buf + wxT(".utf8");
+           l = wxSetlocale(c, buf2.c_str());
+        }
     }
     return l;
 }
@@ -1365,7 +1384,7 @@ wxString wxLocale::GetSystemEncodingName()
     // to Unix98)
     char *oldLocale = strdup(setlocale(LC_CTYPE, NULL));
     setlocale(LC_CTYPE, "");
-    char *alang = nl_langinfo(CODESET);
+    const char *alang = nl_langinfo(CODESET);
     setlocale(LC_CTYPE, oldLocale);
     free(oldLocale);