sc/source/ui/docshell/docsh4.cxx | 11 ++++------- sfx2/source/view/lokhelper.cxx | 6 ++++++ sfx2/source/view/viewsh.cxx | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-)
New commits: commit bbf4b72c5312e7df3c884ac76536ccf07571310a Author: Dennis Francis <[email protected]> AuthorDate: Wed Feb 4 14:47:37 2026 +0530 Commit: Dennis Francis <[email protected]> CommitDate: Wed Feb 4 11:46: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 Signed-off-by: Dennis Francis <[email protected]> Change-Id: I4043a06e5a96a51cfc880b385a4f778df195866d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198647 Reviewed-by: Tomaž Vajngerl <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 43f9e2ac251b..1aa65d41f9d9 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -246,15 +246,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 @@ -271,7 +268,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 d0b7fa7ec55b..5617a450fa70 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -504,6 +504,12 @@ void SfxLokHelper::setViewLocale(int nId, const OUString& rBcp47LanguageTag) if (pViewShell->GetViewShellId() == ViewShellId(nId)) { pViewShell->SetLOKLocale(rBcp47LanguageTag); + // 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 c7e8cc6259a2..6bc4231089de 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -3526,14 +3526,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()
