desktop/source/lib/init.cxx |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 6e5cf6d3aafaede128dd762be273729a271462f8
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Wed Apr 1 20:20:19 2020 +0530
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Thu Apr 2 09:54:57 2020 +0200

    tdf#127158 :lokit: preload liblocaledata_others.so
    
    ...even if LOK_WHITELIST_LANGUAGES does not contain an Asian language.
    Not preloading this module causes locale-fallbacks for example
    when a calc-cell with Asian locale has some date with number-formatting,
    LOOL displays the date with the fallback locale(en_US).
    (more details in comments)
    
    Change-Id: Id8a31565f7f0f0262c044028f55fdf4fe33ecec8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91529
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c544984ade50..612b6a51ceac 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -95,6 +95,8 @@
 
 #include <com/sun/star/linguistic2/LinguServiceManager.hpp>
 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
+#include <com/sun/star/i18n/Calendar2.hpp>
+#include <com/sun/star/i18n/LocaleCalendar2.hpp>
 #include <com/sun/star/i18n/ScriptType.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
 
@@ -5662,6 +5664,14 @@ static void preloadData()
     }
     std::cerr << "\n";
 
+    // Hack to load and cache the module liblocaledata_others.so which is not 
loaded normally
+    // (when loading dictionaries of just non-Asian locales). Creating a 
XCalendar4 of one Asian locale
+    // will cheaply load this missing "others" locale library. Appending an 
Asian locale in
+    // LOK_WHITELIST_LANGUAGES env-var also works but at the cost of loading 
that dictionary.
+    css::uno::Reference< css::i18n::XCalendar4 > xCal = 
css::i18n::LocaleCalendar2::create(comphelper::getProcessComponentContext());
+    css::lang::Locale aAsianLocale = {"hi", "IN", ""};
+    xCal->loadDefaultCalendar(aAsianLocale);
+
     // preload all available thesauri
     css::uno::Reference<linguistic2::XThesaurus> 
xThesaurus(xLngSvcMgr->getThesaurus());
     css::uno::Reference<linguistic2::XSupportedLocales> 
xThesLocales(xSpellChecker, css::uno::UNO_QUERY_THROW);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to