sc/source/ui/docshell/docsh4.cxx | 11 ++++------- sfx2/source/view/lokhelper.cxx | 10 ++++++++++ sfx2/source/view/viewsh.cxx | 4 ++-- 3 files changed, 16 insertions(+), 9 deletions(-)
New commits: commit 359b7db5eecdbe5e8e56660dcd73ff72cba1696b Author: Dennis Francis <[email protected]> AuthorDate: Wed Feb 4 14:47:37 2026 +0530 Commit: Dennis Francis <[email protected]> CommitDate: Thu Feb 5 17:20:18 2026 +0100 lok: sc: changing lok-language affects jsdialog lang Set only the lok-locale when user selects the language from status-bar. Before this commit both lok-locale and lok-language are set when user sets the language, but this causes the jsdialog (UI) language to change too which is not the expected behaviour. This is a follow-up commit to the below patches: 1. 48a5c1c215bc5b0b9471ac67bee0a278fe8984dc sc: lok: spell check is still based on document language... 2. f2d52fd83a1d4fd42c90780357c1552dbed605b4 lok: sc: use view specific calendar conforming to init. locale/language Conflicts: sfx2/source/view/lokhelper.cxx Signed-off-by: Dennis Francis <[email protected]> Change-Id: I4043a06e5a96a51cfc880b385a4f778df195866d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198654 Tested-by: Jenkins diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 063550691a97..494ef94b654e 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -247,15 +247,12 @@ public: DECL_STATIC_LINK(LinkHelp, DispatchHelpLinksHdl, weld::Button&, void); }; -void lcl_setLOKLanguageAndLocale(ScDocShell& rDocSh, ScTabViewShell& rViewShell, const LanguageType eLang) +void lcl_setLOKLocale(ScTabViewShell& rViewShell, const LanguageType eLang) { OUString aLang = LanguageTag(eLang).getBcp47(); /// This is only used for building the lok calendar as of date. - SfxLokHelper::setViewLanguageAndLocale(SfxLokHelper::getView(rViewShell), aLang); - if (SfxBindings* pBindings = rDocSh.GetViewBindings()) - { - pBindings->Invalidate(SID_LANGUAGE_STATUS); - } + /// Don't change the view language as it affects the js-dialog language as well. + SfxLokHelper::setViewLocale(SfxLokHelper::getView(rViewShell), aLang); } } // end anonymous namespace @@ -272,7 +269,7 @@ void ScDocShell::SetLanguage(LanguageType eLatin, LanguageType eCjk, LanguageTyp { if (ScTabViewShell* pViewShell = GetBestViewShell()) { - lcl_setLOKLanguageAndLocale(*this, *pViewShell, eLatin); + lcl_setLOKLocale(*pViewShell, eLatin); } } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index b791b560bb4c..68e102c96afe 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -457,6 +457,16 @@ void SfxLokHelper::setViewLocale(int nId, const OUString& rBcp47LanguageTag) if (SfxViewShell* pViewShell = getViewOfId(nId)) { pViewShell->SetLOKLocale(rBcp47LanguageTag); + if (pViewShell->GetViewShellId() == ViewShellId(nId)) + { + // sync also global getter if we are the current view + bool bIsCurrShell = (pViewShell == SfxViewShell::Current()); + if (bIsCurrShell) + { + comphelper::LibreOfficeKit::setLocale(LanguageTag(rBcp47LanguageTag)); + } + return; + } } } diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 5e5c287f3970..6b6ae17b431e 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -3532,14 +3532,14 @@ void SfxViewShell::SetLOKLocale(const OUString& rBcp47LanguageTag) comphelper::LibreOfficeKit::setLanguageTag(GetLOKLanguageTag()); comphelper::LibreOfficeKit::setLocale(GetLOKLocale()); } + mpCalendar = std::make_unique<CalendarWrapper>(::comphelper::getProcessComponentContext()); + mpCalendar->loadDefaultCalendar(GetLOKLocale().getLocale()); } void SfxViewShell::SetLOKLanguageAndLocale(const OUString& rBcp47LanguageTag) { SetLOKLanguageTag(rBcp47LanguageTag); SetLOKLocale(rBcp47LanguageTag); - mpCalendar = std::make_unique<CalendarWrapper>(::comphelper::getProcessComponentContext()); - mpCalendar->loadDefaultCalendar(GetLOKLocale().getLocale()); } CalendarWrapper& SfxViewShell::GetLOKCalendar()
