diff options
author | Eike Rathke <erack@redhat.com> | 2021-11-07 19:00:41 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2021-11-07 20:11:57 +0100 |
commit | 0f3c19ee61ec371aa32d9f51c3555d3ea8ae9eeb (patch) | |
tree | 2f7acabb3e003e8215cbf1adb2ad64d3d7dfbab7 | |
parent | 4f6f70d9f418593fd64788bb204e6f6f36674fce (diff) |
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.
Change-Id: I8d9e4171bee6bbe9d1c9dcfb7a5fa8fc92ea1a2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124449
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
-rw-r--r-- | svl/source/config/languageoptions.cxx | 2 | ||||
-rw-r--r-- | svtools/source/misc/langtab.cxx | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx index e04abe80f4da..2e7550b98758 100644 --- a/svl/source/config/languageoptions.cxx +++ b/svl/source/config/languageoptions.cxx @@ -48,7 +48,7 @@ SvtScriptType 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 9981cf6862b3..00e676d149ef 100644 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -225,23 +225,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; // Obtain from ICU, or a geeky but usable-in-a-pinch lang-tag. - OUString sLangTag( lcl_getDescription( LanguageTag(eType))); + OUString sLangTag( lcl_getDescription( LanguageTag(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; } |