[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - i18npool/inc i18npool/source svl/source

Eike Rathke erack at redhat.com
Wed Mar 13 10:00:51 PDT 2013


 i18npool/inc/i18npool/languagetag.hxx       |   24 ++++++++++++++++++++++--
 i18npool/source/languagetag/languagetag.cxx |    7 +++++++
 svl/source/numbers/zforlist.cxx             |    2 +-
 3 files changed, 30 insertions(+), 3 deletions(-)

New commits:
commit 1e81d7220990765c0cbc1bdede6ad96bbb399cff
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Mar 13 16:35:46 2013 +0100

    resolved fdo#62278 test for LanguageTag equality resolving system locale
    
    added LanguageTag::equals(), fdo#62278 related
    
    (cherry picked from commit fb26196ce64979ab6dc6c82c0fbdeedb126a3433)
    
    Conflicts:
    	i18npool/inc/i18npool/languagetag.hxx
    	i18npool/source/languagetag/languagetag.cxx
    
    resolved fdo#62278 test for LanguageTag equality resolving system locale
    
    (cherry picked from commit dde0dcd553b676abcb41eaf3f9f1bf797907e22f)
    
    Change-Id: I7c6e91518b3afd7a42d21bcae41283b0e00b833a
    Reviewed-on: https://gerrit.libreoffice.org/2707
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/i18npool/inc/i18npool/languagetag.hxx b/i18npool/inc/i18npool/languagetag.hxx
index bb86b72..1e0ae65 100644
--- a/i18npool/inc/i18npool/languagetag.hxx
+++ b/i18npool/inc/i18npool/languagetag.hxx
@@ -204,10 +204,30 @@ public:
      */
     LanguageTag &                   makeFallback();
 
-    /* Test equality of two LangageTag. */
+    /** Test equality of two LanguageTag, possibly resolving system locale.
+
+        @param bResolveSystem
+               If TRUE, resolve empty language tags denoting the system
+               locale to the real locale used before comparing.
+               If FALSE, the behavior is identical to operator==(), system
+               locales are not resolved first.
+      */
+    bool                            equals( const LanguageTag & rLanguageTag, bool bResolveSystem = false ) const;
+
+    /** Test equality of two LanguageTag.
+
+        Does NOT resolve system, i.e. if the system locale is en-US
+        LanguageTag("")==LanguageTag("en-US") returns false! Use
+        equals(...,true) instead if system locales shall be resolved.
+     */
     bool    operator==( const LanguageTag & rLanguageTag ) const;
 
-    /* Test inequality of two LangageTag. */
+    /** Test inequality of two LanguageTag.
+
+        Does NOT resolve system, i.e. if the system locale is en-US
+        LanguageTag("")!=LanguageTag("en-US") returns true! Use
+        !equals(,...true) instead if system locales shall be resolved.
+     */
     bool    operator!=( const LanguageTag & rLanguageTag ) const;
 
 private:
diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx
index bab2443..9055d2b 100644
--- a/i18npool/source/languagetag/languagetag.cxx
+++ b/i18npool/source/languagetag/languagetag.cxx
@@ -995,6 +995,13 @@ LanguageTag & LanguageTag::makeFallback()
 }
 
 
+bool LanguageTag::equals( const LanguageTag & rLanguageTag, bool bResolveSystem ) const
+{
+    // Compare full language tag strings.
+    return getBcp47( bResolveSystem) == rLanguageTag.getBcp47( bResolveSystem);
+}
+
+
 bool LanguageTag::operator==( const LanguageTag & rLanguageTag ) const
 {
     // Compare full language tag strings but SYSTEM unresolved.
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 0440835..3e55e22 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -972,7 +972,7 @@ sal_uInt32 SvNumberFormatter::ImpGenerateCL( LanguageType eLnge, bool bNoAdditio
         if (LocaleDataWrapper::areChecksEnabled())
         {
             const LanguageTag& rLoadedLocale = xLocaleData->getLoadedLanguageTag();
-            if ( rLoadedLocale != maLanguageTag )
+            if ( !rLoadedLocale.equals( maLanguageTag, true) )
             {
                 OUString aMsg("SvNumerFormatter::ImpGenerateCL: locales don't match:");
                 LocaleDataWrapper::outputCheckMessage( xLocaleData->appendLocaleInfo( aMsg ));


More information about the Libreoffice-commits mailing list