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 d1a6d3fc7a0bce6d9803af91c2ad54e40fc4696d Author: Dennis Francis <[email protected]> AuthorDate: Wed Feb 4 14:47:37 2026 +0530 Commit: Dennis Francis <[email protected]> CommitDate: Wed Feb 4 13:29:40 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/+/198652 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 411e93646b23..fbc627103c1c 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 f8d663211984..2d13aaec3a28 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -456,6 +456,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 06eb1f0a2ebd..509e60665d46 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()
