desktop/source/lib/init.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 91d29f9b9eeddaefdef18aa3e65f12ba3b039f7d
Author:     Andras Timar <[email protected]>
AuthorDate: Mon Feb 16 16:45:05 2026 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Tue Feb 17 09:15:02 2026 +0100

    lok: configure system UI language before preloadData
    
    setLanguageAndLocale() only set SvtSysLocaleOptions but never called
    MsLangId::setConfiguredSystemUILanguage() or
    LanguageTag::setConfiguredSystemLanguage(). This meant that during the
    entire LOKit process lifetime, every call to
    getConfiguredSystemUILanguage() hit the "not configured yet" warning
    and fell back to getSystemUILanguage(), producing hundreds of warnings
    during Collabora Online startup.
    
    Additionally, setLanguageAndLocale() was called after preloadData(),
    so even the SvtSysLocaleOptions weren't set when preloadData()
    constructed SvtSysLocaleOptions and other locale-dependent objects.
    
    Fix both: add the missing MsLangId/LanguageTag configuration calls
    to setLanguageAndLocale(), and move the call before preloadData() in
    the PRE_INIT stage.
    
    This changes two behaviors beyond silencing the warnings:
    
    1) getConfiguredSystemUILanguage() now returns en-US instead of the
       server's system locale (the previous fallback). This is correct
       because LOKit shouldn't depend on the host's system locale, and
       the language is overridden per-document via setLanguageAndLocale()
       on each document load anyway.
    
    2) preloadData() now runs with locale properly configured rather than
       in an unconfigured state. This is more correct: fonts, shortcuts,
       and other preloaded data are now consistent with the initial en-US
       setting that was already intended (the call was there, just ran
       too late).
    
    Change-Id: I0bf62e68e00d5cf05bf072abbee438a67b9393f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199492
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b1ea4870ca37..a8d7738a0a71 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2835,6 +2835,9 @@ void setLanguageAndLocale(OUString const & aLangISO)
     aLocalOptions.SetLocaleConfigString(aLangISO);
     aLocalOptions.SetUILocaleConfigString(aLangISO);
     aLocalOptions.Commit();
+    LanguageTag aTag(aLangISO);
+    MsLangId::setConfiguredSystemUILanguage(aTag.getLanguageType(false));
+    LanguageTag::setConfiguredSystemLanguage(aTag.getLanguageType(false));
 }
 
 void setFormatSpecificFilterData(std::u16string_view sFormat, 
comphelper::SequenceAsHashMap & rFilterDataMap)
@@ -8671,6 +8674,11 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
                 SAL_INFO("lok", "CheckExtensionDependencies failed");
 #endif
 
+            // Configure system language early, before InitVCL() and service
+            // manager preload trigger locale-dependent code paths.
+            MsLangId::setConfiguredSystemUILanguage(LANGUAGE_ENGLISH_US);
+            LanguageTag::setConfiguredSystemLanguage(LANGUAGE_ENGLISH_US);
+
             if (eStage == PRE_INIT)
             {
                 {
@@ -8707,13 +8715,15 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
                     VclAbstractDialogFactory::Create();
                 }
 
+                setLanguageAndLocale(u"en-US"_ustr);
+
                 preloadData();
 
                 // Release Solar Mutex, lo_startmain thread should acquire it.
                 Application::ReleaseSolarMutex();
             }
-
-            setLanguageAndLocale(u"en-US"_ustr);
+            else
+                setLanguageAndLocale(u"en-US"_ustr);
         }
 
         if (eStage != PRE_INIT)

Reply via email to