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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
Andras Timar
2025-01-16 10:56:38 +01:00
committed by Miklos Vajna
parent e4e7616ab4
commit 7b43ce868f
2 changed files with 16 additions and 0 deletions

View File

@ -7775,6 +7775,19 @@ static void preloadData()
}
std::cerr << "\n";
// 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 << "\n";
std::cerr << "Preloading breakiterator\n";
if (aLocales.getLength())
{

View File

@ -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 );
}
}