desktop/source/lib/init.cxx | 13 +++++++++++++ lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 3 +++ 2 files changed, 16 insertions(+)
New commits: commit 7b43ce868f980dc47c37f482900210eae2d0187e Author: Andras Timar <andras.ti...@collabora.com> AuthorDate: Thu Jan 16 10:56:38 2025 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Jan 17 09:57:29 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> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7f09d490ba0a..498e8cb3975b 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -7775,6 +7775,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 8ac156ef8cb3..60cbfb5a87d9 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 <cppuhelper/factory.hxx> #include <cppuhelper/supportsservice.hxx> @@ -138,6 +139,8 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales() { for (const auto& rLocaleName : dict.aLocaleNames) { + if (!comphelper::LibreOfficeKit::isAllowlistedLanguage(rLocaleName)) + continue; aLocaleNamesSet.insert( rLocaleName ); } }