desktop/source/lib/init.cxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit a0b2739b2354b622538304c0846606247bcf09c0
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Jul 24 08:46:38 2022 -0400
Commit:     Ashod Nakashian <a...@collabora.com>
CommitDate: Mon Jul 25 15:34:33 2022 +0200

    lok: initialize the load-language
    
    We need to use the load-language for
    saving the document. This is to avoid
    using the language of the view that is
    issuing the save, which causes all sorts
    of issues (language-translation related).
    This logic was implemented in 4b7b449bbdc5
    but for some reason the load-language
    wasn't set.
    
    This patch sets the load-language.
    
    Signed-off-by: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
    Change-Id: I0cd1574d48a99e6ee84bacf75fc0d9ebe26e526b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137391
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4ab030388e7f..3f708aa781c9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2495,6 +2495,14 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
 
         if (!aLanguage.isEmpty() && isValidLangTag)
         {
+            static bool isLoading = true;
+            if (isLoading)
+            {
+                // Capture the language used to load the document.
+                SfxLokHelper::setLoadLanguage(aLanguage);
+                isLoading = false;
+            }
+
             SfxLokHelper::setDefaultLanguage(aLanguage);
             // Set the LOK language tag, used for dialog tunneling.
             comphelper::LibreOfficeKit::setLanguageTag(LanguageTag(aLanguage));

Reply via email to