sfx2/source/view/lokhelper.cxx |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit e09b3f5f4cd662a596b5d8d6ad4d5e2778e315f4
Author:     Attila Szűcs <[email protected]>
AuthorDate: Tue Jan 9 20:23:44 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Jan 10 11:10:51 2024 +0100

    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 <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 1ee8f262906c..c54551b1637f 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -195,10 +195,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.
@@ -207,9 +203,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* pViewFrame = pViewShell->GetViewFrame();
             pViewFrame->MakeActive_Impl(false);
 

Reply via email to