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>
50void 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(
113 css::uno::UNO_QUERY_THROW)->setLocale(tag.
getLocale(
false));
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);
141 setMsLangIdFallback(docTag.
getBcp47());
LanguageType getLanguageType(bool bResolveSystem=true) const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
static void setConfiguredSystemLanguage(LanguageType nLang)
const OUString & getBcp47(bool bResolveSystem=true) const
LanguageTag & makeFallback()
static LanguageType convertToLanguageTypeWithFallback(const OUString &rBcp47)
LanguageTag & reset(const OUString &rBcp47LanguageTag)
static void setConfiguredComplexFallback(LanguageType nLang)
static void setConfiguredSystemUILanguage(LanguageType nLang)
static void setConfiguredWesternFallback(LanguageType nLang)
static void setConfiguredAsianFallback(LanguageType nLang)
static LanguageType getSystemLanguage()
static std::shared_ptr< ConfigurationChanges > create()
static CommandLineArgs & GetCommandLineArgs()
#define TOOLS_WARN_EXCEPTION(area, stream)
OUString SVT_DLLPUBLIC getInstalledLocaleForLanguage(css::uno::Sequence< OUString > const &installed, OUString const &locale)
OUString SVT_DLLPUBLIC getInstalledLocaleForSystemUILanguage(css::uno::Sequence< OUString > const &installed, bool bRequestInstallIfMissing, const OUString &rPreferredLocale=OUString())
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Reference< XComponentContext > getProcessComponentContext()