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 dde0dcd553b676abcb41eaf3f9f1bf797907e22f Author: Eike Rathke <[email protected]> Date: Wed Mar 13 16:41:34 2013 +0100 resolved fdo#62278 test for LanguageTag equality resolving system locale Change-Id: Ic50c6d02a3feaf72060defa50766b40b5dec1cf7 diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index c2d105d..c8bd75c 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 )); commit fb26196ce64979ab6dc6c82c0fbdeedb126a3433 Author: Eike Rathke <[email protected]> Date: Wed Mar 13 16:35:46 2013 +0100 added LanguageTag::equals(), fdo#62278 related Change-Id: I6471f8eaa46d9203c75569436b233a09fe337910 diff --git a/i18npool/inc/i18npool/languagetag.hxx b/i18npool/inc/i18npool/languagetag.hxx index ff8266d..7dedc8f 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 c510962..2386274 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. _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
