[Libreoffice-commits] core.git: i18npool/source

Eike Rathke erack at redhat.com
Mon Feb 18 15:28:17 PST 2013


 i18npool/source/languagetag/languagetag.cxx |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 2c36a832b85eeff6b4a2f6c6aab599e4b10b8886
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Feb 19 00:27:04 2013 +0100

    for now convert using MsLangId::convertUnxByteStringToLanguage()
    
    Change-Id: Iaedd4bd6eda1db293fa3dc6222c7353ce466ec04

diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx
index 8494735..2117771 100644
--- a/i18npool/source/languagetag/languagetag.cxx
+++ b/i18npool/source/languagetag/languagetag.cxx
@@ -260,24 +260,28 @@ LanguageTag::LanguageTag( const rtl_Locale & rLocale )
     // looking for '.' dot delimiter or '@' modifier content.
     if (!maLocale.Variant.isEmpty())
     {
+        OString aStr = OUStringToOString( maLocale.Language + "_" + maLocale.Country + maLocale.Variant,
+                RTL_TEXTENCODING_UTF8);
         /* FIXME: let liblangtag parse this entirely with
          * lt_tag_convert_from_locale() but that needs a patch to pass the
          * string. */
 #if 0
-        OString aStr = OUStringToOString( maLocale.Language + "-" + maLocale.Country + maLocale.Variant,
-                RTL_TEXTENCODING_UTF8);
         myLtError aError;
         theDataRef::get().incRef();
         mpImplLangtag = lt_tag_convert_from_locale( aStr.getStr(), &aError.p);
         maBcp47 = OStringToOUString( lt_tag_get_string( MPLANGTAG), RTL_TEXTENCODING_UTF8);
         mbInitializedBcp47 = true;
-        maLocale = lang::Locale();
-        mbInitializedLocale = false;
 #else
-        SAL_WARN( "i18npool.langtag", "rtl_Locale Variant modifier not handled");
-        // For now clear anything unknown to us.
-        maLocale.Variant = OUString();
+        mnLangID = MsLangId::convertUnxByteStringToLanguage( aStr);
+        if (mnLangID == LANGUAGE_DONTKNOW)
+        {
+            SAL_WARN( "i18npool.langtag", "LanguageTag(rtl_Locale) - unknown: " << aStr);
+            mnLangID = LANGUAGE_ENGLISH_US;     // we need _something_ here
+        }
+        mbInitializedLangID = true;
 #endif
+        maLocale = lang::Locale();
+        mbInitializedLocale = false;
     }
 }
 


More information about the Libreoffice-commits mailing list