]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/intl.cpp
[wxGTK2] gtk+-2.8.0 compatibility. Removed the usage of pango_x_get_context to not...
[wxWidgets.git] / src / common / intl.cpp
index 9dfb288cd0a44c627988311d103fe7a7ab0a6a55..1f360d9a5a4d7c3c966ea1c6cd52ae6a7bb2d753 100644 (file)
@@ -79,6 +79,8 @@
 #include "wx/encconv.h"
 #include "wx/hashmap.h"
 #include "wx/ptr_scpd.h"
+#include "wx/app.h"
+#include "wx/apptrait.h"
 
 #if defined(__WXMAC__)
   #include  "wx/mac/private.h"  // includes mac headers
@@ -100,9 +102,6 @@ typedef wxUint32 size_t32;
 const size_t32 MSGCATALOG_MAGIC    = 0x950412de;
 const size_t32 MSGCATALOG_MAGIC_SW = 0xde120495;
 
-// extension of ".mo" files
-#define MSGCATALOG_EXTENSION  _T(".mo")
-
 // the constants describing the format of lang_LANG locale string
 static const size_t LEN_LANG = 2;
 static const size_t LEN_SUBLANG = 2;
@@ -499,7 +498,6 @@ public:
     ~wxPluralFormsCalculator() {}
 
     void  init(wxPluralFormsToken::Number nplurals, wxPluralFormsNode* plural);
-    wxString getString() const;
 
 private:
     wxPluralFormsToken::Number m_nplurals;
@@ -1106,7 +1104,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName,
                szName, searchPath.c_str());
 
   wxFileName fn(szName);
-  fn.SetExt(MSGCATALOG_EXTENSION);
+  fn.SetExt(_T("mo"));
   wxString strFullName;
   if ( !wxFindFileInPath(&strFullName, searchPath, fn.GetFullPath()) ) {
     wxLogVerbose(_("catalog file for domain '%s' not found."), szName);
@@ -1474,8 +1472,19 @@ bool wxLocale::Init(const wxChar *szName,
   m_pMsgCat = NULL;
   bool bOk = true;
   if ( bLoadDefault )
+  {
     bOk = AddCatalog(wxT("wxstd"));
 
+    // there may be a catalog with toolkit specific overrides, it is not
+    // an error if this does not exist
+    if ( bOk && wxTheApp )
+    {
+      wxAppTraits *traits = wxTheApp->GetTraits();
+      if (traits)
+        AddCatalog(traits->GetToolkitInfo().name.BeforeFirst(wxT('/')).MakeLower());
+    }
+  }
+
   return bOk;
 }
 
@@ -1795,7 +1804,7 @@ void wxLocale::AddCatalogLookupPathPrefix(const wxString& prefix)
          (langFull.Len() == LEN_FULL && langFull[LEN_LANG] == wxT('_')) )
     {
         // 0. Make sure the lang is according to latest ISO 639
-        //    (this is neccessary because glibc uses iw and in instead
+        //    (this is necessary because glibc uses iw and in instead
         //    of he and id respectively).
 
         // the language itself (second part is the dialect/sublang)
@@ -2281,12 +2290,17 @@ wxFontEncoding wxLocale::GetSystemEncoding()
 #if defined(__WIN32__) && !defined(__WXMICROWIN__)
     UINT codepage = ::GetACP();
 
-    // wxWidgets only knows about CP1250-1257, 932, 936, 949, 950
+    // wxWidgets only knows about CP1250-1257, 874, 932, 936, 949, 950
     if ( codepage >= 1250 && codepage <= 1257 )
     {
         return (wxFontEncoding)(wxFONTENCODING_CP1250 + codepage - 1250);
     }
 
+    if ( codepage == 874 )
+    {
+        return wxFONTENCODING_CP874;
+    }
+
     if ( codepage == 932 )
     {
         return wxFONTENCODING_CP932;