sc/source/ui/docshell/docsh4.cxx | 12 +++++------- sfx2/source/view/lokhelper.cxx | 6 ++++++ sfx2/source/view/viewsh.cxx | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-)
New commits: commit 6b1212fd0763555dce7b5f1bd8a9de094ec8981e Author: Dennis Francis <[email protected]> AuthorDate: Wed Feb 4 14:47:37 2026 +0530 Commit: Andras Timar <[email protected]> CommitDate: Wed Feb 4 14:20:23 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: sc/source/ui/docshell/docsh4.cxx Signed-off-by: Dennis Francis <[email protected]> Change-Id: I4043a06e5a96a51cfc880b385a4f778df195866d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198672 Tested-by: Andras Timar <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 6e161d02a015..ff3adac82114 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -246,14 +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(); - SfxLokHelper::setViewLanguageAndLocale(SfxLokHelper::getView(rViewShell), aLang); - if (SfxBindings* pBindings = rDocSh.GetViewBindings()) - { - pBindings->Invalidate(SID_LANGUAGE_STATUS); - } + /// This is only used for building the lok calendar as of date. + /// Don't change the view language as it affects the js-dialog language as well. + SfxLokHelper::setViewLocale(SfxLokHelper::getView(rViewShell), aLang); } } // end anonymous namespace @@ -270,7 +268,7 @@ void ScDocShell::SetLanguage(LanguageType eLatin, LanguageType eCjk, LanguageTyp { if (ScTabViewShell* pViewShell = GetBestViewShell()) { - lcl_setLOKLanguageAndLocale(*this, *pViewShell, eLatin); + lcl_setLOKLocale(*pViewShell, eLatin); } } else 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()
