LOK: fix language warning in setView

Made the warning before the new language set.
This way we log the old (wrong) and new (good) language.

Elseway we could save the old languages to a temporal variable,
set the language, and do the warning with the saved variable, but
i think the extra variables would be a waste of memory.

Change-Id: I0b69f49d07e9130bf1538c2c8e1d0b09cf82091f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161841
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit e09b3f5f4c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161916
Tested-by: Jenkins
This commit is contained in:
Attila Szűcs 2024-01-09 20:23:44 +01:00 committed by Caolán McNamara
parent 36f232e276
commit f97dc9d815

View file

@ -194,10 +194,6 @@ void SfxLokHelper::setView(int nId)
if (bIsCurrShell && comphelper::LibreOfficeKit::getLanguageTag().getBcp47() == pViewShell->GetLOKLanguageTag().getBcp47())
return;
// update the current LOK language and locale for the dialog tunneling
comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag());
comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale());
if (bIsCurrShell)
{
// If we wanted to set the SfxViewShell that is actually set, we could skip it.
@ -206,9 +202,15 @@ void SfxLokHelper::setView(int nId)
SAL_WARN("lok", "LANGUAGE mismatch at setView! ... old (wrong) lang:"
<< comphelper::LibreOfficeKit::getLanguageTag().getBcp47()
<< " new lang:" << pViewShell->GetLOKLanguageTag().getBcp47());
return;
}
// update the current LOK language and locale for the dialog tunneling
comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag());
comphelper::LibreOfficeKit::setLocale(pViewShell->GetLOKLocale());
if (bIsCurrShell)
return;
SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
rViewFrame.MakeActive_Impl(false);