]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/intl.cpp
respect the encoding of the text style and not only the global control font encoding...
[wxWidgets.git] / src / common / intl.cpp
index 443c1b0c6758c6244ce7aceb7b60252039203952..ad84ce7ba43aef476e0ab07a2a5ac3c0a53b079c 100644 (file)
 
 #if wxUSE_INTL
 
-// standard headers
+#ifndef WX_PRECOMP
+    #include "wx/dynarray.h"
+    #include "wx/string.h"
+    #include "wx/intl.h"
+    #include "wx/log.h"
+    #include "wx/utils.h"
+    #include "wx/app.h"
+    #include "wx/hashmap.h"
+#endif // WX_PRECOMP
 
 #ifndef __WXWINCE__
-#include <locale.h>
+    #include <locale.h>
 #endif
 
+// standard headers
 #include <ctype.h>
 #include <stdlib.h>
 #ifdef HAVE_LANGINFO_H
-  #include <langinfo.h>
+    #include <langinfo.h>
 #endif
 
-// wxWidgets
-#ifndef WX_PRECOMP
-    #include "wx/string.h"
-    #include "wx/intl.h"
-    #include "wx/log.h"
-    #include "wx/debug.h"
-    #include "wx/utils.h"
-    #include "wx/dynarray.h"
-#endif // WX_PRECOMP
-
 #ifdef __WIN32__
     #include "wx/msw/private.h"
 #elif defined(__UNIX_LIKE__)
 #include "wx/module.h"
 #include "wx/fontmap.h"
 #include "wx/encconv.h"
-#include "wx/hashmap.h"
 #include "wx/ptr_scpd.h"
-#include "wx/app.h"
 #include "wx/apptrait.h"
 #include "wx/stdpaths.h"
 
 #if defined(__WXMAC__)
-  #include  "wx/mac/private.h"  // includes mac headers
+    #include  "wx/mac/private.h"  // includes mac headers
 #endif
 
 // ----------------------------------------------------------------------------
@@ -1586,11 +1583,13 @@ bool wxLocale::Init(const wxChar *szName,
 
     // there may be a catalog with toolkit specific overrides, it is not
     // an error if this does not exist
-    if ( bOk && wxTheApp )
+    if ( bOk )
     {
-      wxAppTraits *traits = wxTheApp->GetTraits();
-      if (traits)
-        AddCatalog(traits->GetToolkitInfo().name.BeforeFirst(wxT('/')).MakeLower());
+      wxString port(wxPlatformInfo().GetPortIdName());
+      if ( !port.empty() )
+      {
+        AddCatalog(port.BeforeFirst(wxT('/')).MakeLower());
+      }
     }
   }
 
@@ -1942,9 +1941,9 @@ void wxLocale::AddCatalogLookupPathPrefix(const wxString& prefix)
     // check for this
 
     // do we have just the language (or sublang too)?
-    bool justLang = langFull.Len() == LEN_LANG;
+    bool justLang = langFull.length() == LEN_LANG;
     if ( justLang ||
-         (langFull.Len() == LEN_FULL && langFull[LEN_LANG] == wxT('_')) )
+         (langFull.length() == LEN_FULL && langFull[LEN_LANG] == wxT('_')) )
     {
         // 0. Make sure the lang is according to latest ISO 639
         //    (this is necessary because glibc uses iw and in instead
@@ -2452,9 +2451,10 @@ wxFontEncoding wxLocale::GetSystemEncoding()
         wxFontEncoding enc = wxFontMapperBase::GetEncodingFromName(encname);
 
         // on some modern Linux systems (RedHat 8) the default system locale
-        // is UTF8 -- but it isn't supported by wxGTK in ANSI build at all so
+        // is UTF8 -- but it isn't supported by wxGTK1 in ANSI build at all so
         // don't even try to use it in this case
-#if !wxUSE_UNICODE && (defined(__WXGTK__) || defined(__WXMOTIF__))
+#if !wxUSE_UNICODE && \
+        ((defined(__WXGTK__) && !defined(__WXGTK20__)) || defined(__WXMOTIF__))
         if ( enc == wxFONTENCODING_UTF8 )
         {
             // the most similar supported encoding...
@@ -3560,7 +3560,6 @@ void wxLocale::InitLanguagesDB()
    LNG(wxLANGUAGE_SANGHO,                     "sg"   , 0              , 0                                 , "Sangho")
    LNG(wxLANGUAGE_SANSKRIT,                   "sa"   , LANG_SANSKRIT  , SUBLANG_DEFAULT                   , "Sanskrit")
    LNG(wxLANGUAGE_SCOTS_GAELIC,               "gd"   , 0              , 0                                 , "Scots Gaelic")
-   LNG(wxLANGUAGE_SERBIAN,                    "sr_YU", LANG_SERBIAN   , SUBLANG_DEFAULT                   , "Serbian")
    LNG(wxLANGUAGE_SERBIAN_CYRILLIC,           "sr_YU", LANG_SERBIAN   , SUBLANG_SERBIAN_CYRILLIC          , "Serbian (Cyrillic)")
    LNG(wxLANGUAGE_SERBIAN_LATIN,              "sr_YU", LANG_SERBIAN   , SUBLANG_SERBIAN_LATIN             , "Serbian (Latin)")
    LNG(wxLANGUAGE_SERBO_CROATIAN,             "sh"   , 0              , 0                                 , "Serbo-Croatian")