summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorMert Tumer <mert.tumer@collabora.com>2022-05-10 13:06:06 +0300
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-10-22 19:02:06 +0200
commit7fbea38b7aa5335abef55b445df88ee571d18360 (patch)
tree4236a1f808badf332e59daeb000a91ee3203ec1e /unotools
parent2c0669846fe26dae2bb64308517db685037e2cf9 (diff)
Load the locales from config file for languagetool
Locales needs to be read again in the Preferences/Writing Aids section and since this is a network operation it can cause a problem. Better to list all the supported locales in the xcu and load it right away. Signed-off-by: Mert Tumer <mert.tumer@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135598 Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153959 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com> (cherry picked from commit 84bdf9e81a63a8bd308709c86b51bf3900a23c50) Change-Id: Iad9201101aa167ad33f479c67f72649786e1f2cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158330 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/lingucfg.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index 571601e1663a..1a4172c7844a 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -941,6 +941,27 @@ bool SvtLinguConfig::GetSupportedDictionaryFormatsFor(
return bSuccess;
}
+bool SvtLinguConfig::GetLocaleListFor( const OUString &rSetName, const OUString &rSetEntry, css::uno::Sequence< OUString > &rLocaleList ) const
+{
+ if (rSetName.isEmpty() || rSetEntry.isEmpty())
+ return false;
+ bool bSuccess = false;
+ try
+ {
+ uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW );
+ xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW );
+ if (xNA->getByName( "Locales" ) >>= rLocaleList)
+ bSuccess = true;
+ DBG_ASSERT( rLocaleList.hasElements(), "Locale list is empty" );
+ }
+ catch (uno::Exception &)
+ {
+ }
+ return bSuccess;
+}
+
static bool lcl_GetFileUrlFromOrigin(
OUString /*out*/ &rFileUrl,
const OUString &rOrigin )