summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-09-13 13:03:27 +0200
committerEike Rathke <erack@redhat.com>2016-09-13 13:03:39 +0200
commit6f8ea7e89ea190b9462c945d55a3ad8777b2f3ef (patch)
tree6f6b510505c986266e30ee6fc16c507357a971aa
parentf882555332fffbd3ea82c3a25a05ebebe3884415 (diff)
avoid loading all calendars of a locale
Change-Id: I42d572a5dbd4c89351bd1f03aae75b9b7dbe7e30
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx20
1 files changed, 11 insertions, 9 deletions
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 1c996c54f9b6..8897db910ba2 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -509,6 +509,16 @@ bool LocaleDataWrapper::doesSecondaryCalendarUseEC( const OUString& rName ) cons
if (rName.isEmpty())
return false;
+ // Check language tag first to avoid loading all calendars of this locale.
+ LanguageTag aLoaded( getLoadedLanguageTag());
+ OUString aBcp47( aLoaded.getBcp47());
+ // So far determine only by locale, we know for a few.
+ /* TODO: check date format codes? or add to locale data? */
+ if ( aBcp47 != "ja-JP" &&
+ aBcp47 != "lo-LA" &&
+ aBcp47 != "zh-TW")
+ return false;
+
::utl::ReadWriteGuard aGuard( aMutex );
if (!bSecondaryCalendarValid)
@@ -521,15 +531,7 @@ bool LocaleDataWrapper::doesSecondaryCalendarUseEC( const OUString& rName ) cons
if (!xSecondaryCalendar->Name.equalsIgnoreAsciiCase( rName))
return false;
- LanguageTag aLoaded( getLoadedLanguageTag());
- OUString aBcp47( aLoaded.getBcp47());
- // So far determine only by locale, we know for a few.
- /* TODO: check date format codes? or add to locale data? */
- return
- aBcp47 == "ja-JP" ||
- aBcp47 == "lo-LA" ||
- aBcp47 == "zh-TW"
- ;
+ return true;
}
void LocaleDataWrapper::getDefaultCalendarImpl()