sw/source/uibase/shells/langhelper.cxx |    5 +++--
 sw/source/uibase/shells/textsh1.cxx    |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit a613204272151bc533ace9c2794dc812e06aba27
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Fri Oct 29 19:39:21 2021 +0100
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Fri Oct 29 22:45:23 2021 +0200

    tdf#145386 Avoid LANGUAGE_PROCESS_OR_USER_DEFAULT messing up the status bar.
    
    Importing a simple .doc gives this language code in various bits
    of logic, unexpectedly - which then results in very odd
    FeatureStateEvents containing state like this:
    
      uno::Sequence of length 4 = {"{en-US};en-US", "1", "", "Doc.doc"}
    
    where really they should be:
    
      uno::Sequence of length 4 = {"English (USA);en-US", "1", "", "Doc.doc"}
    
    and worse - that looks like JSON.
    
    Change-Id: I8d9e4171bee6bbe9d1c9dcfb7a5fa8fc92ea1a2c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124448
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>

diff --git a/sw/source/uibase/shells/langhelper.cxx 
b/sw/source/uibase/shells/langhelper.cxx
index 32a6cb1a5793..27326c973fb0 100644
--- a/sw/source/uibase/shells/langhelper.cxx
+++ b/sw/source/uibase/shells/langhelper.cxx
@@ -39,6 +39,7 @@
 #include <editeng/langitem.hxx>
 
 #include <svl/languageoptions.hxx>
+#include <i18nlangtag/mslangid.hxx>
 #include <svtools/langtab.hxx>
 #include <svl/slstitm.hxx>
 #include <svl/stritem.hxx>
@@ -75,14 +76,14 @@ namespace SwLangHelper
 
         vcl::Window* pWin = rEditView.GetWindow();
         if(pWin)
-            nLang = pWin->GetInputLanguage();
+            nLang = MsLangId::getRealLanguage( pWin->GetInputLanguage() );
         if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
             aKeyboardLang = SvtLanguageTable::GetLanguageString( nLang );
 
         // get the language that is in use
         OUString aCurrentLang("*");
         SfxItemSet aSet(pOLV->GetAttribs());
-        nLang = SwLangHelper::GetCurrentLanguage( aSet,nScriptType );
+        nLang = MsLangId::getRealLanguage( SwLangHelper::GetCurrentLanguage( 
aSet,nScriptType ) );
         if (nLang != LANGUAGE_DONTKNOW)
             aCurrentLang = SvtLanguageTable::GetLanguageString( nLang );
 
diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index 630d54a2efc6..e7747e36db76 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -26,6 +26,7 @@
 #include <comphelper/lok.hxx>
 
 #include <i18nutil/unicode.hxx>
+#include <i18nlangtag/mslangid.hxx>
 #include <i18nlangtag/languagetag.hxx>
 #include <svl/languageoptions.hxx>
 #include <editeng/langitem.hxx>
@@ -1623,13 +1624,13 @@ void SwTextShell::GetState( SfxItemSet &rSet )
                 // get keyboard language
                 OUString aKeyboardLang;
                 SwEditWin& rEditWin = GetView().GetEditWin();
-                LanguageType nLang = rEditWin.GetInputLanguage();
+                LanguageType nLang = MsLangId::getRealLanguage( 
rEditWin.GetInputLanguage() );
                 if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
                     aKeyboardLang = SvtLanguageTable::GetLanguageString( nLang 
);
 
                 // get the language that is in use
                 OUString aCurrentLang = "*";
-                nLang = SwLangHelper::GetCurrentLanguage( rSh );
+                nLang = MsLangId::getRealLanguage( 
SwLangHelper::GetCurrentLanguage( rSh ) );
                 if (nLang != LANGUAGE_DONTKNOW)
                 {
                     aCurrentLang = SvtLanguageTable::GetLanguageString( nLang 
);

Reply via email to