22 #include <com/sun/star/configuration/theDefaultProvider.hpp>
23 #include <com/sun/star/container/XNameAccess.hpp>
24 #include <com/sun/star/lang/XLocalizable.hpp>
25 #include <com/sun/star/uno/Exception.hpp>
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <com/sun/star/uno/Sequence.hxx>
33 #include <officecfg/Office/Linguistic.hxx>
34 #include <officecfg/Setup.hxx>
35 #include <officecfg/System.hxx>
36 #include <rtl/ustring.hxx>
50 void setMsLangIdFallback(OUString
const & locale) {
58 case SvtScriptType::ASIAN:
61 case SvtScriptType::COMPLEX:
75 setMsLangIdFallback(officecfg::System::L10N::SystemLocale::get());
77 setMsLangIdFallback(officecfg::System::L10N::Locale::get());
78 css::uno::Sequence<OUString> inst(
79 officecfg::Setup::Office::InstalledLocales::get()->getElementNames());
80 OUString locale(officecfg::Office::Linguistic::General::UILocale::get());
81 if (!locale.isEmpty()) {
83 if (locale.isEmpty()) {
86 std::shared_ptr<comphelper::ConfigurationChanges> batch(
88 officecfg::Office::Linguistic::General::UILocale::set(
91 }
catch (
const css::uno::Exception &) {
96 if (locale.isEmpty()) {
100 if (locale.isEmpty()) {
103 if (locale.isEmpty()) {
110 css::uno::Reference<css::lang::XLocalizable>(
111 css::configuration::theDefaultProvider::get(
115 std::shared_ptr<comphelper::ConfigurationChanges> batch(
117 officecfg::Setup::L10N::ooLocale::set(locale, batch);
119 }
catch (
const css::uno::Exception &) {
129 OUString setupSysLoc(officecfg::Setup::L10N::ooSetupSystemLocale::get());
130 if (!setupSysLoc.isEmpty())
131 aSysLocTag.reset( setupSysLoc);
133 aSysLocTag.makeFallback();
141 setMsLangIdFallback(docTag.getBcp47());
static void setConfiguredComplexFallback(LanguageType nLang)
static void setConfiguredAsianFallback(LanguageType nLang)
static void setConfiguredSystemUILanguage(LanguageType nLang)
static std::shared_ptr< ConfigurationChanges > create()
static void setConfiguredSystemLanguage(LanguageType nLang)
LanguageType getLanguageType(bool bResolveSystem=true) const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
OUString getInstalledLocaleForLanguage(css::uno::Sequence< OUString > const &installed, OUString const &locale)
static LanguageType convertToLanguageTypeWithFallback(const OUString &rBcp47)
static void setConfiguredWesternFallback(LanguageType nLang)
static LanguageType getSystemLanguage()
#define TOOLS_WARN_EXCEPTION(area, stream)
LanguageType GetLanguage(SwWrtShell &rSh, sal_uInt16 nLangWhichId)
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
static CommandLineArgs & GetCommandLineArgs()
OUString getInstalledLocaleForSystemUILanguage(const css::uno::Sequence< OUString > &rLocaleElementNames, bool bRequestInstallIfMissing, const OUString &rPreferredLocale)
Reference< XComponentContext > getProcessComponentContext()
void setLocale(const LanguageTag &languageTag)