]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/intl.cpp
ensure that WIN32 is defined, winsock2.h relies on it being defined and fails in...
[wxWidgets.git] / src / common / intl.cpp
index a1f81ebec7464d3fd16d0dbf167aaff2f91eaf16..bffac09ffd5e909f917fa23dcf7ec208122c9e7e 100644 (file)
@@ -1177,6 +1177,9 @@ static wxString GetFullSearchPath(const wxString& lang)
 bool wxMsgCatalogFile::Load(const wxString& szDirPrefix, const wxString& szName,
                             wxPluralFormsCalculatorPtr& rPluralFormsCalculator)
 {
+    wxCHECK_MSG( szDirPrefix.length() >= LEN_LANG, false,
+                    "invalid language specification" );
+
   wxString searchPath;
 
 #if wxUSE_FONTMAP
@@ -2570,6 +2573,16 @@ bool wxLocale::AddCatalog(const wxString& szDomain,
                           const wxString& msgIdCharset)
 
 {
+    wxCHECK_MSG( IsOk(), false, "must initialize catalog first" );
+
+
+    // It is OK to not load catalog if the msgid language and m_language match,
+    // in which case we can directly display the texts embedded in program's
+    // source code:
+    if ( msgIdLanguage == m_language )
+        return true;
+
+
     wxMsgCatalog *pMsgCat = new wxMsgCatalog;
 
     if ( pMsgCat->Load(m_strShort, szDomain, msgIdCharset, m_bConvertEncoding) )
@@ -2586,12 +2599,6 @@ bool wxLocale::AddCatalog(const wxString& szDomain,
     delete pMsgCat;
 
 
-    // It is OK to not load catalog if the msgid language and m_language match,
-    // in which case we can directly display the texts embedded in program's
-    // source code:
-    if ( msgIdLanguage == m_language )
-        return true;
-
     // If there's no exact match, we may still get partial match where the
     // (basic) language is same, but the country differs. For example, it's
     // permitted to use en_US strings from sources even if m_language is en_GB:
@@ -3458,9 +3465,9 @@ void wxLocale::InitLanguagesDB()
    LNG(wxLANGUAGE_SANGHO,                     "sg"   , 0              , 0                                 , wxLayout_LeftToRight, "Sangho")
    LNG(wxLANGUAGE_SANSKRIT,                   "sa"   , LANG_SANSKRIT  , SUBLANG_DEFAULT                   , wxLayout_LeftToRight, "Sanskrit")
    LNG(wxLANGUAGE_SCOTS_GAELIC,               "gd"   , 0              , 0                                 , wxLayout_LeftToRight, "Scots Gaelic")
-   LNG(wxLANGUAGE_SERBIAN,                    "sr_SR", LANG_SERBIAN   , SUBLANG_DEFAULT                   , wxLayout_LeftToRight, "Serbian")
-   LNG(wxLANGUAGE_SERBIAN_CYRILLIC,           "sr_SR", LANG_SERBIAN   , SUBLANG_SERBIAN_CYRILLIC          , wxLayout_LeftToRight, "Serbian (Cyrillic)")
-   LNG(wxLANGUAGE_SERBIAN_LATIN,              "sr_SR@latin", LANG_SERBIAN   , SUBLANG_SERBIAN_LATIN             , wxLayout_LeftToRight, "Serbian (Latin)")
+   LNG(wxLANGUAGE_SERBIAN,                    "sr_RS", LANG_SERBIAN   , SUBLANG_DEFAULT                   , wxLayout_LeftToRight, "Serbian")
+   LNG(wxLANGUAGE_SERBIAN_CYRILLIC,           "sr_RS", LANG_SERBIAN   , SUBLANG_SERBIAN_CYRILLIC          , wxLayout_LeftToRight, "Serbian (Cyrillic)")
+   LNG(wxLANGUAGE_SERBIAN_LATIN,              "sr_RS@latin", LANG_SERBIAN   , SUBLANG_SERBIAN_LATIN             , wxLayout_LeftToRight, "Serbian (Latin)")
    LNG(wxLANGUAGE_SERBIAN_CYRILLIC,           "sr_YU", LANG_SERBIAN   , SUBLANG_SERBIAN_CYRILLIC          , wxLayout_LeftToRight, "Serbian (Cyrillic)")
    LNG(wxLANGUAGE_SERBIAN_LATIN,              "sr_YU@latin", LANG_SERBIAN   , SUBLANG_SERBIAN_LATIN             , wxLayout_LeftToRight, "Serbian (Latin)")
    LNG(wxLANGUAGE_SERBO_CROATIAN,             "sh"   , 0              , 0                                 , wxLayout_LeftToRight, "Serbo-Croatian")