[Libreoffice-commits] core.git: 5 commits - i18npool/inc i18npool/qa i18npool/source rsc/source svtools/langsupport svtools/source svx/source

Eike Rathke erack at redhat.com
Wed Apr 3 12:19:48 PDT 2013


 i18npool/inc/i18npool/lang.h             |   12 ----
 i18npool/inc/i18npool/mslangid.hxx       |    3 +
 i18npool/qa/cppunit/test_languagetag.cxx |   50 +++++++++++++++++++
 i18npool/source/isolang/isolang.cxx      |    8 +++
 rsc/source/parser/rscdb.cxx              |   79 +++++++++----------------------
 rsc/source/parser/rscibas.cxx            |   75 ++++++++++-------------------
 svtools/langsupport/langsupport.cxx      |    3 -
 svtools/source/misc/langtab.src          |    9 ---
 svx/source/dialog/langbox.cxx            |    4 -
 9 files changed, 113 insertions(+), 130 deletions(-)

New commits:
commit 1fa455b396c8d0ae1686f2f9e4c0ee04f503081f
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Apr 3 21:16:01 2013 +0200

    ditch unused LANGUAGE_USER[1-9]
    
    Change-Id: I5a3b2b27fa2a7ad22cab2ae6d833707f9e490f27

diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h
index b761fff..e3643fc 100644
--- a/i18npool/inc/i18npool/lang.h
+++ b/i18npool/inc/i18npool/lang.h
@@ -375,18 +375,6 @@ typedef unsigned short LanguageType;
 #define LANGUAGE_YORUBA                     0x046A
 #define LANGUAGE_ZULU                       0x0435
 
-/* Not real, but used for legacy. */
-#define LANGUAGE_USER1                      0x0201
-#define LANGUAGE_USER2                      0x0202
-#define LANGUAGE_USER3                      0x0203
-#define LANGUAGE_USER4                      0x0204
-#define LANGUAGE_USER5                      0x0205
-#define LANGUAGE_USER6                      0x0206
-#define LANGUAGE_USER7                      0x0207
-#define LANGUAGE_USER8                      0x0208
-#define LANGUAGE_USER9                      0x0209
-/* Don't use higher USER values here, we reserve them for extension. */
-
 /*! use only for import/export of MS documents, number formatter maps it to
  *! LANGUAGE_SYSTEM and then to effective system language */
 #define LANGUAGE_SYSTEM_DEFAULT             0x0800
diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx
index 9b74545..ca86a9f 100644
--- a/rsc/source/parser/rscibas.cxx
+++ b/rsc/source/parser/rscibas.cxx
@@ -140,16 +140,6 @@ void RscLangEnum::Init( RscNameTable& rNames )
             nTokenCounter++;
         }
     }
-
-    SetConstant( rNames.Put( "LANGUAGE_USER1", CONSTNAME, LANGUAGE_USER1 ), LANGUAGE_USER1 );
-    SetConstant( rNames.Put( "LANGUAGE_USER2", CONSTNAME, LANGUAGE_USER2 ), LANGUAGE_USER2 );
-    SetConstant( rNames.Put( "LANGUAGE_USER3", CONSTNAME, LANGUAGE_USER3 ), LANGUAGE_USER3 );
-    SetConstant( rNames.Put( "LANGUAGE_USER4", CONSTNAME, LANGUAGE_USER4 ), LANGUAGE_USER4 );
-    SetConstant( rNames.Put( "LANGUAGE_USER5", CONSTNAME, LANGUAGE_USER5 ), LANGUAGE_USER5 );
-    SetConstant( rNames.Put( "LANGUAGE_USER6", CONSTNAME, LANGUAGE_USER6 ), LANGUAGE_USER6 );
-    SetConstant( rNames.Put( "LANGUAGE_USER7", CONSTNAME, LANGUAGE_USER7 ), LANGUAGE_USER7 );
-    SetConstant( rNames.Put( "LANGUAGE_USER8", CONSTNAME, LANGUAGE_USER8 ), LANGUAGE_USER8 );
-    SetConstant( rNames.Put( "EXTERN", CONSTNAME, LANGUAGE_USER9 ), LANGUAGE_USER9 );
 }
 
 Atom RscLangEnum::AddLanguage( const char* pLang, RscNameTable& rNames )
diff --git a/svtools/langsupport/langsupport.cxx b/svtools/langsupport/langsupport.cxx
index 1d5cf7f..efcc5f5 100644
--- a/svtools/langsupport/langsupport.cxx
+++ b/svtools/langsupport/langsupport.cxx
@@ -65,9 +65,6 @@ SAL_IMPLEMENT_MAIN()
         {
             LanguageType eLang = aTable.GetTypeAtIndex(i);
 
-            if (eLang >= LANGUAGE_USER1 && eLang <= LANGUAGE_USER9)
-                continue;
-
             if (eLang == LANGUAGE_DONTKNOW ||
                 eLang == LANGUAGE_NONE ||
                 eLang == LANGUAGE_HID_HUMAN_INTERFACE_DEVICE ||
diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src
index eb777d3..cafddd7 100644
--- a/svtools/source/misc/langtab.src
+++ b/svtools/source/misc/langtab.src
@@ -194,15 +194,6 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE
         < "Ukrainian" ; LANGUAGE_UKRAINIAN ; > ;
         < "Uzbek Latin" ; LANGUAGE_UZBEK_LATIN ; > ;
         < "Welsh" ; LANGUAGE_WELSH ; > ;
-        < "User 1" ; LANGUAGE_USER1 ; > ;
-        < "User 2" ; LANGUAGE_USER2 ; > ;
-        < "User 3" ; LANGUAGE_USER3 ; > ;
-        < "User 4" ; LANGUAGE_USER4 ; > ;
-        < "User 5" ; LANGUAGE_USER5 ; > ;
-        < "User 6" ; LANGUAGE_USER6 ; > ;
-        < "User 7" ; LANGUAGE_USER7 ; > ;
-        < "User 8" ; LANGUAGE_USER8 ; > ;
-        < "User 9" ; LANGUAGE_USER9 ; > ;
         < "Latin" ; LANGUAGE_LATIN ; > ;
         < "Esperanto" ; LANGUAGE_USER_ESPERANTO ; > ;
         < "Kinyarwanda (Rwanda)" ; LANGUAGE_USER_KINYARWANDA ; > ;
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index a4aac24..5dca172 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -168,8 +168,7 @@ void SvxLanguageBox::Init()
 
             bool bInsert = true;
             if ((LANGUAGE_DONTKNOW == nLangType)  ||
-                (LANGUAGE_SYSTEM   == nLangType)  ||
-                (LANGUAGE_USER1 <= nLangType  &&  nLangType <= LANGUAGE_USER9))
+                (LANGUAGE_SYSTEM   == nLangType))
             {
                 bInsert = false;
             }
@@ -289,7 +288,6 @@ void SvxLanguageBox::SetLanguageList( sal_Int16 nLangList,
             if ( nLangType != LANGUAGE_DONTKNOW &&
                  nLangType != LANGUAGE_SYSTEM &&
                  nLangType != LANGUAGE_NONE &&
-                 (nLangType < LANGUAGE_USER1 || nLangType > LANGUAGE_USER9) &&
                  (MsLangId::getSubLanguage( nLangType) != 0 ||
                   (nLangList & LANG_LIST_ALSO_PRIMARY_ONLY)) &&
                  ((nLangList & LANG_LIST_ALL) != 0 ||
commit ef291d99fb706675607acdc80f1fd05e952f0a34
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Apr 3 20:59:40 2013 +0200

    rsc with language tags
    
    Change-Id: I5401a9bcbd1e359ef62e8d667edf6ead1479ce46

diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx
index 0b70e09..38c5a19 100644
--- a/rsc/source/parser/rscdb.cxx
+++ b/rsc/source/parser/rscdb.cxx
@@ -23,6 +23,7 @@
 #include <string.h>
 
 #include <tools/rc.h>
+#include <i18npool/languagetag.hxx>
 #include <rtl/strbuf.hxx>
 #include <sal/log.hxx>
 #include <sal/macros.h>
@@ -74,76 +75,42 @@ RscTypCont :: RscTypCont( RscError * pErrHdl,
     Init();
 }
 
-static sal_uInt32 getLangIdAndShortenLocale( RscTypCont* pTypCont,
-                                             rtl::OString& rLang,
-                                             rtl::OString& rCountry,
-                                             rtl::OString& rVariant )
-{
-    rtl::OStringBuffer aLangStr( 64 );
-    aLangStr.append( rLang.toAsciiLowerCase() );
-    if( !rCountry.isEmpty() )
-    {
-        aLangStr.append( '-' );
-        aLangStr.append( rCountry.toAsciiUpperCase() );
-    }
-    if( !rVariant.isEmpty() )
-    {
-        aLangStr.append( '-' );
-        aLangStr.append( rVariant );
-    }
-    rtl::OString aL( aLangStr.makeStringAndClear() );
-    sal_uInt32 nRet = GetLangId( aL );
-    if( nRet == 0 )
-    {
-        pTypCont->AddLanguage( aL.getStr() );
-        nRet = GetLangId( aL );
-    }
-    if( !rVariant.isEmpty() )
-        rVariant = rtl::OString();
-    else if( !rCountry.isEmpty() )
-        rCountry = rtl::OString();
-    else
-        rLang = rtl::OString();
-#if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, " %s (0x%hx)", aL.getStr(), (int)nRet );
-#endif
-    return nRet;
-}
-
 rtl::OString RscTypCont::ChangeLanguage(const rtl::OString& rNewLang)
 {
     rtl::OString aRet = aLanguage;
     aLanguage = rNewLang;
 
-    rtl::OString aLang = aLanguage;
-    rtl::OString aLg, aCountry, aVariant;
-    sal_Int32 nIndex = 0;
-    aLg = aLang.getToken( 0, '-', nIndex );
-    if( nIndex != -1 )
-        aCountry = aLang.getToken( 0, '-', nIndex );
-    if( nIndex != -1 )
-        aVariant = aLang.copy( nIndex );
-
+    ::std::vector< OUString > aFallbacks;
+    if (rNewLang.isEmpty())
+        aFallbacks.push_back( "" );     // do not resolve to SYSTEM (en-US)
+    else
+        aFallbacks = LanguageTag( OStringToOUString( rNewLang, RTL_TEXTENCODING_ASCII_US)).getFallbackStrings();
     bool bAppendEnUsFallback =
         ! (rNewLang.equalsIgnoreAsciiCase( "en-US" ) ||
            rNewLang.equalsIgnoreAsciiCase( "x-no-translate" ) );
+    if (bAppendEnUsFallback)
+        aFallbacks.push_back( "en-US");
 
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "RscTypCont::ChangeLanguage:" );
+    fprintf( stderr, "RscTypCont::ChangeLanguage: " );
 #endif
-    aLangFallbacks.clear();
 
-    do
-    {
-        aLangFallbacks.push_back(getLangIdAndShortenLocale( this, aLg, aCountry, aVariant ) );
-    } while( !aLg.isEmpty() );
+    aLangFallbacks.clear();
 
-    if( bAppendEnUsFallback )
+    for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it)
     {
-        aLg = "en";
-        aCountry = "US";
-        aVariant = rtl::OString();
-        aLangFallbacks.push_back( getLangIdAndShortenLocale( this, aLg, aCountry, aVariant ) );
+        rtl::OString aLang( OUStringToOString( *it, RTL_TEXTENCODING_ASCII_US));
+        sal_uInt32 nID = GetLangId( aLang );
+        bool bAdd = (nID == 0);
+        if ( bAdd )
+        {
+            AddLanguage( aLang.getStr() );
+            nID = GetLangId( aLang );
+        }
+#if OSL_DEBUG_LEVEL > 1
+        fprintf( stderr, " '%s' (0x%hx) (%s)", aLang.getStr(), (int)nID, (bAdd ? "added" : "exists") );
+#endif
+        aLangFallbacks.push_back( nID);
     }
 
 #if OSL_DEBUG_LEVEL > 1
diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx
index 194c974..9b74545 100644
--- a/rsc/source/parser/rscibas.cxx
+++ b/rsc/source/parser/rscibas.cxx
@@ -84,48 +84,35 @@ void RscLangEnum::Init( RscNameTable& rNames )
     {
 #if OSL_DEBUG_LEVEL > 2
         fprintf( stderr, "ISO Language in : %d, 0x%04x, %s\n",
-                 (int)nIndex,
-                 (unsigned)pLangEntry->mnLang,
-                 OUStringToOString( LanguageTag( pLangEntry->mnLang ).getBcp47(), RTL_TEXTENCODING_ASCII_US).getStr() );
+                (int)nIndex,
+                (unsigned)pLangEntry->mnLang,
+                OUStringToOString( pLangEntry->getTagString(), RTL_TEXTENCODING_ASCII_US).getStr());
+        fprintf( stderr, "ISO Language out:");
 #endif
-        rtl::OString aLang(pLangEntry->maLangStr, strlen(pLangEntry->maLangStr));
-        rtl::OString aCountry(pLangEntry->maCountry, strlen(pLangEntry->maCountry));
-        if ( aCountry.isEmpty() || aLang.equalsIgnoreAsciiCase(aCountry) )
+        LanguageTag aLanguageTag( pLangEntry->getTagString());
+        ::std::vector< OUString > aFallbacks( aLanguageTag.getFallbackStrings());
+        for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it)
         {
+            OString aLang( OUStringToOString( *it, RTL_TEXTENCODING_ASCII_US));
             SetConstant( rNames.Put( aLang.getStr(), CONSTNAME, mnLangId ), mnLangId );
-            if ( ! GetLangId( aLang ))
+            bool bAdd = (GetLangId( aLang ) == 0);
+            if ( bAdd )
                 ULong_Iso_map[ aLang ] = mnLangId;
 #if OSL_DEBUG_LEVEL > 2
-            fprintf( stderr, "ISO Language out: %s 0x%lx\n", aLang.getStr(), mnLangId );
+            fprintf( stderr, " %s 0x%lx (%s)", aLang.getStr(), mnLangId, (bAdd ? "added" : "exists") );
 #endif
             mnLangId++;
         }
-        else
-        {
-            SetConstant( rNames.Put( aLang.getStr(), CONSTNAME, mnLangId ), mnLangId );
-            if ( ! GetLangId( aLang ))
-                ULong_Iso_map[ aLang ] = mnLangId;
-#if OSL_DEBUG_LEVEL > 2
-            fprintf( stderr, "ISO Language out: %s 0x%lx", aLang.getStr(), mnLangId );
-#endif
-            mnLangId++;
-            aLang = aLang + rtl::OString( '-' ) + aCountry.toAsciiUpperCase();
-            SetConstant( rNames.Put( aLang.getStr(), CONSTNAME, mnLangId ), mnLangId );
-            if ( ! GetLangId( aLang ))
-                ULong_Iso_map[ aLang ] = mnLangId;
 #if OSL_DEBUG_LEVEL > 2
-            fprintf( stderr, " %s 0x%lx\n", aLang.getStr(), mnLangId );
+        fprintf( stderr, "\n");
 #endif
-            mnLangId++;
-// hack - survive "x-no-translate"
-            if (aLang.equalsL(RTL_CONSTASCII_STRINGPARAM("en-US")))
-            {
-                SetConstant( rNames.Put( "x-comment", CONSTNAME, mnLangId ), mnLangId );
-                mnLangId++;
-            }
-        }
         nIndex++;
     }
+    // hack - survive "x-no-translate"
+    /* XXX: that ^^^ was the original comment, but we're adding "x-comment"
+     * here? Which is good anyway. */
+    SetConstant( rNames.Put( "x-comment", CONSTNAME, mnLangId ), mnLangId );
+    mnLangId++;
 
     rtl::OString aEnvIsoTokens = getenv( "RSC_LANG_ISO" );
     if ( !aEnvIsoTokens.isEmpty() )
@@ -139,10 +126,12 @@ void RscLangEnum::Init( RscNameTable& rNames )
             if ( !aIsoToken.isEmpty() )
             {
                 SetConstant( rNames.Put( aIsoToken.getStr(), CONSTNAME, mnLangId ), mnLangId );
-                if ( ! GetLangId( aIsoToken ))
+                bool bAdd = (GetLangId( aIsoToken ) == 0);
+                if ( bAdd )
                     ULong_Iso_map[ aIsoToken ] = mnLangId;
 #if OSL_DEBUG_LEVEL > 2
-                fprintf( stderr, "Env ISO Language out: %s 0x%lx\n", aIsoToken.getStr(), mnLangId );
+                fprintf( stderr, "Env ISO Language out: %s 0x%lx (%s)\n",
+                        aIsoToken.getStr(), mnLangId, (bAdd ? "added" : "exists") );
 #endif
                 mnLangId++;
             }
@@ -166,20 +155,22 @@ void RscLangEnum::Init( RscNameTable& rNames )
 Atom RscLangEnum::AddLanguage( const char* pLang, RscNameTable& rNames )
 {
     Atom nResult = 0;
+    bool bAdd = false;
     KEY_STRUCT aStruct;
     if( ! rNames.Get( nResult = pHS->getID( pLang ), &aStruct ) )
     {
         SetConstant( nResult = rNames.Put( pLang, CONSTNAME, mnLangId ), mnLangId );
         // insert new lang to ULong_Iso_map
         rtl::OString aLang( pLang );
-        if ( ! GetLangId( aLang ))
+        bAdd = (GetLangId( aLang ) == 0);
+        if ( bAdd )
             ULong_Iso_map[ aLang ] = mnLangId;
         // increase id counter
         mnLangId++;
     }
-    #if OSL_DEBUG_LEVEL > 2
-    fprintf( stderr, "AddLanguage( %s ) = %d\n", pLang, nResult );
-    #endif
+#if OSL_DEBUG_LEVEL > 2
+    fprintf( stderr, "AddLanguage( '%s' ) = %d (%s)\n", pLang, nResult, (bAdd ? "added" : "exists") );
+#endif
     return nResult;
 }
 
commit 8d470713b6187e6284077a7b951335ecacd8befa
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Apr 3 18:35:05 2013 +0200

    test IsoLangEntry table LanguageTag conversions
    
    Change-Id: Ie56e68459f655a66bf33368cee5e9a99b9dd0141

diff --git a/i18npool/qa/cppunit/test_languagetag.cxx b/i18npool/qa/cppunit/test_languagetag.cxx
index f2f6e30..227be20 100644
--- a/i18npool/qa/cppunit/test_languagetag.cxx
+++ b/i18npool/qa/cppunit/test_languagetag.cxx
@@ -14,6 +14,7 @@
 #include <cppunit/extensions/HelperMacros.h>
 #include <cppunit/plugin/TestPlugIn.h>
 
+#include <i18npool/mslangid.hxx>
 #include <i18npool/languagetag.hxx>
 
 #include <rtl/ustring.hxx>
@@ -41,9 +42,11 @@ public:
     virtual ~TestLanguageTag() {}
 
     void testAllTags();
+    void testAllIsoLangEntries();
 
     CPPUNIT_TEST_SUITE(TestLanguageTag);
     CPPUNIT_TEST(testAllTags);
+    CPPUNIT_TEST(testAllIsoLangEntries);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -274,6 +277,53 @@ void TestLanguageTag::testAllTags()
     }
 }
 
+void TestLanguageTag::testAllIsoLangEntries()
+{
+    const MsLangId::IsoLangEntry* pLangEntry;
+    sal_Int32 nIndex = 0;
+    while (((pLangEntry = MsLangId::getIsoLangEntry( nIndex++ )) != NULL) && (pLangEntry->mnLang != LANGUAGE_DONTKNOW))
+    {
+        LanguageTag aTagString( pLangEntry->getTagString(), true);
+        LanguageTag aTagID( pLangEntry->mnLang);
+        if (pLangEntry->getTagString() != aTagString.getBcp47())
+        {
+            OString aMessage( OUStringToOString( pLangEntry->getTagString(), RTL_TEXTENCODING_ASCII_US));
+            aMessage += " -> " + OUStringToOString( aTagString.getBcp47(), RTL_TEXTENCODING_ASCII_US);
+            CPPUNIT_ASSERT_MESSAGE( aMessage.getStr(), pLangEntry->getTagString() == aTagString.getBcp47());
+        }
+        if (pLangEntry->getTagString() != aTagID.getBcp47())
+        {
+            // There are multiple mappings, ID must be equal after conversions.
+            LanguageTag aTagBack( aTagID.getBcp47(), true);
+            if (aTagString.getLanguageType() != aTagBack.getLanguageType())
+            {
+                OString aMessage( OUStringToOString( pLangEntry->getTagString(), RTL_TEXTENCODING_ASCII_US));
+                aMessage += " " + OString::number( aTagString.getLanguageType(), 16) +
+                    " -> " + OString::number( aTagBack.getLanguageType(), 16);
+                CPPUNIT_ASSERT_MESSAGE( aMessage.getStr(), aTagString.getLanguageType() == aTagBack.getLanguageType());
+            }
+        }
+#if 0
+        // This does not hold, there are cases like 'ar'
+        // LANGUAGE_ARABIC_PRIMARY_ONLY that when mapped back results in
+        // 'ar-SA' as default locale.
+        if (pLangEntry->mnLang != aTagString.getLanguageType())
+        {
+            // There are multiple mappings, string must be equal after conversions.
+            LanguageTag aTagBack( aTagString.getLanguageType());
+            if (aTagID.getBcp47() != aTagBack.getBcp47())
+            {
+                OString aMessage( OUStringToOString( pLangEntry->getTagString(), RTL_TEXTENCODING_ASCII_US));
+                aMessage += " " + OUStringToOString( aTagID.getBcp47(), RTL_TEXTENCODING_ASCII_US) +
+                    " -> " + OUStringToOString( aTagBack.getBcp47(), RTL_TEXTENCODING_ASCII_US);
+                CPPUNIT_ASSERT_MESSAGE( aMessage.getStr(), aTagID.getBcp47() == aTagBack.getBcp47());
+            }
+        }
+#endif
+    }
+
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION( TestLanguageTag );
 
 }
commit f51aff9e69b2eb5ad60167a055a969842eb3bcb8
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Apr 3 16:31:16 2013 +0200

    let IsoLangEntry decide how to form a language tag string
    
    Change-Id: I868cd8ea0610b6b8dd8155cdc72f7d238f279ef2

diff --git a/i18npool/inc/i18npool/mslangid.hxx b/i18npool/inc/i18npool/mslangid.hxx
index b3d04ec..b29c6df 100644
--- a/i18npool/inc/i18npool/mslangid.hxx
+++ b/i18npool/inc/i18npool/mslangid.hxx
@@ -180,6 +180,9 @@ public:
         LanguageType  mnLang;
         sal_Char      maLangStr[4];
         sal_Char      maCountry[3];
+
+        /** Obtain a language tag string with '-' separator. */
+        OUString getTagString() const;
     };
 
     /** @internal - Return a pointer to the IsoLangEntry of the underlying table,
diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx
index 942cd84..e41d228 100644
--- a/i18npool/source/isolang/isolang.cxx
+++ b/i18npool/source/isolang/isolang.cxx
@@ -520,6 +520,14 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] =
 static MsLangId::IsoLangEntry aLastResortFallbackEntry =
 { LANGUAGE_ENGLISH_US, "en", "US" };
 
+OUString MsLangId::IsoLangEntry::getTagString() const
+{
+    if (maCountry[0])
+        return OUString( OUString::createFromAscii( maLangStr) + "-" + OUString::createFromAscii( maCountry));
+    else
+        return OUString::createFromAscii( maLangStr);
+}
+
 // -----------------------------------------------------------------------
 
 // In this table are the countries which should mapped to a specific
commit f8e697abc35a3fb910859a26a23d8e3a9de6753e
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Apr 3 14:39:48 2013 +0200

    correct number of format operands for fprintf
    
    Change-Id: I4fbfd3cacaa87ed1a8faa123a269d82f82ba22da

diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx
index a2a5d15..194c974 100644
--- a/rsc/source/parser/rscibas.cxx
+++ b/rsc/source/parser/rscibas.cxx
@@ -83,9 +83,9 @@ void RscLangEnum::Init( RscNameTable& rNames )
     while ( NULL != ( pLangEntry = MsLangId::getIsoLangEntry( nIndex )) && ( pLangEntry->mnLang != LANGUAGE_DONTKNOW ))
     {
 #if OSL_DEBUG_LEVEL > 2
-        fprintf( stderr, "ISO Language in : %d\n",
+        fprintf( stderr, "ISO Language in : %d, 0x%04x, %s\n",
                  (int)nIndex,
-                 pLangEntry->mnLang,
+                 (unsigned)pLangEntry->mnLang,
                  OUStringToOString( LanguageTag( pLangEntry->mnLang ).getBcp47(), RTL_TEXTENCODING_ASCII_US).getStr() );
 #endif
         rtl::OString aLang(pLangEntry->maLangStr, strlen(pLangEntry->maLangStr));


More information about the Libreoffice-commits mailing list