diff options
author | Mert Tumer <mert.tumer@collabora.com> | 2022-05-10 13:06:06 +0300 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2023-07-07 12:01:40 +0200 |
commit | 81b0d9a951c9b15f4f1a76d45d0bd955b4dfc95b (patch) | |
tree | f199497e4d5e75515787e3b15e4ca248b4213fd9 /unotools | |
parent | 6d30ef2d9418ff6d2bd89c20a61c757bc3abb9b2 (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>
Change-Id: I2ced6789df2a1d6fa2996e2d6b7d2a18e266afac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154154
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 0b39db9172ef..af1eaee4aa9d 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 ) |