svl/source/config/languageoptions.cxx | 2 +- svtools/source/misc/langtab.cxx | 13 +++++++------ sw/source/uibase/shells/langhelper.cxx | 5 ++--- sw/source/uibase/shells/textsh1.cxx | 5 ++--- 4 files changed, 12 insertions(+), 13 deletions(-)
New commits: commit 66a0b5f04d1ec06d2631a9f739b995d365bfc879 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Wed Nov 10 13:40:12 2021 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Fri Nov 12 14:54:55 2021 +0100 Resolves: tdf#145386 Use "Default" for LANGUAGE_PROCESS_OR_USER_DEFAULT There's no, specifically not in Writer, handling of the LCID 0x0400 LANGUAGE_PROCESS_OR_USER_DEFAULT language/locale concept other than the number formatter mapping it to LANGUAGE_SYSTEM. Use the LANGUAGE_SYSTEM "Default" string in UI (status bar, status menu, language list) but keep the LCID, and don't append the resolved locale string as it is also displayed both in the Font Western and CJK listboxes. This ends up as two list entries, like * Default - English (UK) first entry * Default last entry of which the second would be selected. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124449 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins (cherry picked from commit 0f3c19ee61ec371aa32d9f51c3555d3ea8ae9eeb) Conflicts: svtools/source/misc/langtab.cxx Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124204 Tested-by: Jenkins Tested-by: Michael Meeks <michael.me...@collabora.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> Change-Id: I35b84dbf6e5913773949aad3dad802d79e93c2af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124965 diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx index f00812b30b8d..3b490c6ac1fe 100644 --- a/svl/source/config/languageoptions.cxx +++ b/svl/source/config/languageoptions.cxx @@ -142,7 +142,7 @@ SvtScriptType SvtLanguageOptions::GetScriptTypeOfLanguage( LanguageType nLang ) { if( LANGUAGE_DONTKNOW == nLang ) nLang = LANGUAGE_ENGLISH_US; - else if( LANGUAGE_SYSTEM == nLang ) + else if (LANGUAGE_SYSTEM == nLang || LANGUAGE_PROCESS_OR_USER_DEFAULT == nLang) nLang = SvtSysLocale().GetLanguageTag().getLanguageType(); sal_Int16 nScriptType = MsLangId::getScriptType( nLang ); diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx index 2b4311cde7f6..519e7da7268c 100644 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -208,23 +208,24 @@ bool SvtLanguageTable::HasLanguageType( const LanguageType eType ) OUString SvtLanguageTableImpl::GetString( const LanguageType eType ) const { - LanguageType eLang = MsLangId::getReplacementForObsoleteLanguage( eType ); - sal_uInt32 nPos = FindIndex(eLang); + const LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( eType); + const sal_uInt32 nPos = (eType == LANGUAGE_PROCESS_OR_USER_DEFAULT ? + FindIndex(LANGUAGE_SYSTEM) : FindIndex( nLang)); if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < GetEntryCount() ) return m_aStrings[nPos].first; //Rather than return a fairly useless "Unknown" name, return a geeky but usable-in-a-pinch lang-tag - OUString sLangTag( lcl_getDescription( LanguageTag::convertToBcp47(eType))); + OUString sLangTag( lcl_getDescription( LanguageTag::convertToBcp47(nLang))); SAL_WARN("svtools.misc", "Language: 0x" - << std::hex << eType + << std::hex << nLang << " with unknown name, so returning lang-tag of: " << sLangTag); // And add it to the table if it is an on-the-fly-id, which it usually is, // so it is available in all subsequent language boxes. - if (LanguageTag::isOnTheFlyID( eType)) - const_cast<SvtLanguageTableImpl*>(this)->AddItem( sLangTag, eType); + if (LanguageTag::isOnTheFlyID( nLang)) + const_cast<SvtLanguageTableImpl*>(this)->AddItem( sLangTag, nLang); return sLangTag; } diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index 27326c973fb0..32a6cb1a5793 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -39,7 +39,6 @@ #include <editeng/langitem.hxx> #include <svl/languageoptions.hxx> -#include <i18nlangtag/mslangid.hxx> #include <svtools/langtab.hxx> #include <svl/slstitm.hxx> #include <svl/stritem.hxx> @@ -76,14 +75,14 @@ namespace SwLangHelper vcl::Window* pWin = rEditView.GetWindow(); if(pWin) - nLang = MsLangId::getRealLanguage( pWin->GetInputLanguage() ); + nLang = 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 = MsLangId::getRealLanguage( SwLangHelper::GetCurrentLanguage( aSet,nScriptType ) ); + nLang = 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 e7747e36db76..630d54a2efc6 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -26,7 +26,6 @@ #include <comphelper/lok.hxx> #include <i18nutil/unicode.hxx> -#include <i18nlangtag/mslangid.hxx> #include <i18nlangtag/languagetag.hxx> #include <svl/languageoptions.hxx> #include <editeng/langitem.hxx> @@ -1624,13 +1623,13 @@ void SwTextShell::GetState( SfxItemSet &rSet ) // get keyboard language OUString aKeyboardLang; SwEditWin& rEditWin = GetView().GetEditWin(); - LanguageType nLang = MsLangId::getRealLanguage( rEditWin.GetInputLanguage() ); + LanguageType nLang = rEditWin.GetInputLanguage(); if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) aKeyboardLang = SvtLanguageTable::GetLanguageString( nLang ); // get the language that is in use OUString aCurrentLang = "*"; - nLang = MsLangId::getRealLanguage( SwLangHelper::GetCurrentLanguage( rSh ) ); + nLang = SwLangHelper::GetCurrentLanguage( rSh ); if (nLang != LANGUAGE_DONTKNOW) { aCurrentLang = SvtLanguageTable::GetLanguageString( nLang );