desktop/source/lib/init.cxx | 13 +++++++++++++ lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 3 +++ 2 files changed, 16 insertions(+)
New commits: commit 0e512e7aeeda61e95d2eafc2a566a3cef24fadf6 Author: Andras Timar <andras.ti...@collabora.com> AuthorDate: Thu Jan 16 10:56:38 2025 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Jan 17 12:29:08 2025 +0100 LOK: preload hyphenators Without this fix the hyphenation feature did not work when bind mounting was not available, e.g. in docker containers. Change-Id: I800012b5229ce5a56a5698db7057e3a27e760be3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180337 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit 7b43ce868f980dc47c37f482900210eae2d0187e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180382 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 9b6f387c37f2..d48ded705473 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -7957,6 +7957,19 @@ static void preloadData() } std::cerr << " "; + // preload all available hyphenators + css::uno::Reference<linguistic2::XHyphenator> xHyphenator(xLngSvcMgr->getHyphenator()); + css::uno::Reference<linguistic2::XSupportedLocales> xHyphLocales(xHyphenator, css::uno::UNO_QUERY_THROW); + aLocales = xHyphLocales->getLocales(); + std::cerr << "Preloading local hyphenators: "; + for (auto &it : std::as_const(aLocales)) + { + std::cerr << LanguageTag::convertToBcp47(it) << " "; + css::beans::PropertyValues aNone; + xHyphenator->createPossibleHyphens(u"forcefed"_ustr, it, aNone); + } + std::cerr << " "; + std::cerr << "Preloading breakiterator "; if (aLocales.getLength()) { diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 1e527c8e8ada..a00b4e5a3d2f 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/uno/Reference.h> +#include <comphelper/lok.hxx> #include <comphelper/sequence.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/factory.hxx> @@ -150,6 +151,8 @@ void Hyphenator::ensureLocales() { for (const auto& rLocaleName : dict.aLocaleNames) { + if (!comphelper::LibreOfficeKit::isAllowlistedLanguage(rLocaleName)) + continue; aLocaleNamesSet.insert( rLocaleName ); } }