From cbcec4425e04e3614a2025b49fdc221216ac51d3 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 12 Feb 2021 07:45:22 +0100 Subject: tdf#121245: also set ooLocale when language is set by command line ooLocale is re-written in each invocation of langselect::prepareLocale from Desktop::Init; previously an exception was when it was set by command line. This special treatment was from initial '--language' implementation in commit d47dd2bf33b0a2a9a5251a871bb7fe0573724274. The problem here is this setting is the fallback for multiple code paths, so many UI elements got language from old ooLocale data in that case. This setting is re-written every time the program is started, so it should be no harm in writing it also in command line case. Alternatively we could try to fix all places to use configured system UI language from MsLangId instead, or to create a backend layer for ooLocale that itself uses that. Change-Id: Idf7212901620bc158f704ba21747294634e48ae1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110776 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- desktop/source/app/langselect.cxx | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'desktop/source/app/langselect.cxx') diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx index 711d567d2063..2958ed8786b5 100644 --- a/desktop/source/app/langselect.cxx +++ b/desktop/source/app/langselect.cxx @@ -93,13 +93,9 @@ bool prepareLocale() { } } } - bool cmdLanguage = false; if (locale.isEmpty()) { locale = getInstalledLocaleForLanguage( inst, Desktop::GetCommandLineArgs().GetLanguage()); - if (!locale.isEmpty()) { - cmdLanguage = true; - } } if (locale.isEmpty()) { locale = getInstalledLocaleForSystemUILanguage(inst, true); @@ -115,15 +111,13 @@ bool prepareLocale() { css::configuration::theDefaultProvider::get( comphelper::getProcessComponentContext()), css::uno::UNO_QUERY_THROW)->setLocale(tag.getLocale(false)); - if (!cmdLanguage) { - try { - std::shared_ptr batch( - comphelper::ConfigurationChanges::create()); - officecfg::Setup::L10N::ooLocale::set(locale, batch); - batch->commit(); - } catch (const css::uno::Exception &) { - TOOLS_WARN_EXCEPTION("desktop.app", "ignoring"); - } + try { + std::shared_ptr batch( + comphelper::ConfigurationChanges::create()); + officecfg::Setup::L10N::ooLocale::set(locale, batch); + batch->commit(); + } catch (const css::uno::Exception &) { + TOOLS_WARN_EXCEPTION("desktop.app", "ignoring"); } MsLangId::setConfiguredSystemUILanguage(tag.getLanguageType(false)); -- cgit