unotools/source/i18n/localedatawrapper.cxx |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 6f8ea7e89ea190b9462c945d55a3ad8777b2f3ef
Author: Eike Rathke <er...@redhat.com>
Date:   Tue Sep 13 13:03:27 2016 +0200

    avoid loading all calendars of a locale
    
    Change-Id: I42d572a5dbd4c89351bd1f03aae75b9b7dbe7e30

diff --git a/unotools/source/i18n/localedatawrapper.cxx 
b/unotools/source/i18n/localedatawrapper.cxx
index 1c996c5..8897db9 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()
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to