Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2707

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/07/2707/1

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
---
M i18npool/inc/i18npool/languagetag.hxx
M i18npool/source/languagetag/languagetag.cxx
M svl/source/numbers/zforlist.cxx
3 files changed, 30 insertions(+), 3 deletions(-)



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 @@
      */
     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 @@
 }
 
 
+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 @@
         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 ));

-- 
To view, visit https://gerrit.libreoffice.org/2707
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c6e91518b3afd7a42d21bcae41283b0e00b833a
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Eike Rathke <erack@redhat.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.