summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i18npool/inc/i18npool/languagetag.hxx24
-rw-r--r--i18npool/source/languagetag/languagetag.cxx7
2 files changed, 29 insertions, 2 deletions
diff --git a/i18npool/inc/i18npool/languagetag.hxx b/i18npool/inc/i18npool/languagetag.hxx
index ff8266d2de79..7dedc8f16bbc 100644
--- a/i18npool/inc/i18npool/languagetag.hxx
+++ b/i18npool/inc/i18npool/languagetag.hxx
@@ -236,10 +236,30 @@ public:
*/
::std::vector< OUString > getFallbackStrings() const;
- /* 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 c51096255a32..238627415400 100644
--- a/i18npool/source/languagetag/languagetag.cxx
+++ b/i18npool/source/languagetag/languagetag.cxx
@@ -1094,6 +1094,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.