Kaydet (Commit) 4189b715 authored tarafından Eike Rathke's avatar Eike Rathke

suppress legacy locales, fdo#44112 related

With MsLangId::isLegacy() locales can be suppressed in language lists
and are not offered unless actually used at the current position of the
document. Language attribution now handles adding a language/locale to
the list on the fly.

For example, Serbian (Latin or Cyrillic) for "Serbia and Montenegro" are
legacy locales, the confederation doesn't exist anymore. A further
candidate would be pap-AN as the Netherlands Antilles ceased to exist,
see fdo#44112.

Suppressing "Serbian Cyrillic (Serbia and Montenegro)" also has the nice
benefit of narrowing the language list box width a little ...

Change-Id: Id05cce328622465016901524b759369c18bc4dbd
üst 955c5539
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#include <unotools/localedatawrapper.hxx> #include <unotools/localedatawrapper.hxx>
#include <i18nlangtag/lang.h> #include <i18nlangtag/lang.h>
#include <i18nlangtag/mslangid.hxx>
#include <svx/dialogs.hrc> #include <svx/dialogs.hrc>
#include <svtools/colorcfg.hxx> #include <svtools/colorcfg.hxx>
...@@ -319,6 +320,8 @@ void SvxNumberFormatTabPage::Init_Impl() ...@@ -319,6 +320,8 @@ void SvxNumberFormatTabPage::Init_Impl()
// initialize language ListBox // initialize language ListBox
m_pLbLanguage->InsertLanguage( LANGUAGE_SYSTEM ); m_pLbLanguage->InsertLanguage( LANGUAGE_SYSTEM );
/* TODO: any reason we're doing a manual init here instead of using
* SvxLanguageBoxBase::SetLanguageList( LANG_LIST_ONLY_KNOWN, ...)? */
// Don't list ambiguous locales where we won't be able to convert the // Don't list ambiguous locales where we won't be able to convert the
// LanguageType back to an identical Language_Country name and therefore // LanguageType back to an identical Language_Country name and therefore
// couldn't load the i18n LocaleData. Show DebugMsg in non-PRODUCT version. // couldn't load the i18n LocaleData. Show DebugMsg in non-PRODUCT version.
...@@ -327,7 +330,8 @@ void SvxNumberFormatTabPage::Init_Impl() ...@@ -327,7 +330,8 @@ void SvxNumberFormatTabPage::Init_Impl()
sal_Int32 nCount = xLang.getLength(); sal_Int32 nCount = xLang.getLength();
for ( sal_Int32 i=0; i<nCount; i++ ) for ( sal_Int32 i=0; i<nCount; i++ )
{ {
m_pLbLanguage->InsertLanguage( xLang[i] ); if (!MsLangId::isLegacy( xLang[i]))
m_pLbLanguage->InsertLanguage( xLang[i] );
} }
} }
......
...@@ -472,6 +472,22 @@ bool MsLangId::isNonLatinWestern( LanguageType nLang ) ...@@ -472,6 +472,22 @@ bool MsLangId::isNonLatinWestern( LanguageType nLang )
} }
// static
bool MsLangId::isLegacy( LanguageType nLang )
{
switch (nLang)
{
case LANGUAGE_SERBIAN_CYRILLIC_SAM:
case LANGUAGE_SERBIAN_LATIN_SAM:
/* TODO: activate once dictionary was renamed from pap-AN to
* pap-CW, or the pap-CW one supports also pap-AN, see fdo#44112 */
//case LANGUAGE_PAPIAMENTU:
return true;
}
return false;
}
// static // static
LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang, bool /*bUserInterfaceSelection*/ ) LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang, bool /*bUserInterfaceSelection*/ )
{ {
......
...@@ -172,6 +172,9 @@ public: ...@@ -172,6 +172,9 @@ public:
static LanguageType getReplacementForObsoleteLanguage( LanguageType nLang, static LanguageType getReplacementForObsoleteLanguage( LanguageType nLang,
bool bUserInterfaceSelection = false ); bool bUserInterfaceSelection = false );
/** Whether locale is legacy, i.e. country ot confederation doesn't exist anymore. */
static bool isLegacy( LanguageType nLang );
/** @ATTENTION: these are _ONLY_ to be called by the application's /** @ATTENTION: these are _ONLY_ to be called by the application's
configuration! */ configuration! */
......
...@@ -267,6 +267,7 @@ void SvxLanguageBoxBase::SetLanguageList( sal_Int16 nLangList, ...@@ -267,6 +267,7 @@ void SvxLanguageBoxBase::SetLanguageList( sal_Int16 nLangList,
if ( nLangType != LANGUAGE_DONTKNOW && if ( nLangType != LANGUAGE_DONTKNOW &&
nLangType != LANGUAGE_SYSTEM && nLangType != LANGUAGE_SYSTEM &&
nLangType != LANGUAGE_NONE && nLangType != LANGUAGE_NONE &&
!MsLangId::isLegacy( nLangType) &&
(MsLangId::getSubLanguage( nLangType) != 0 || (MsLangId::getSubLanguage( nLangType) != 0 ||
(nLangList & LANG_LIST_ALSO_PRIMARY_ONLY)) && (nLangList & LANG_LIST_ALSO_PRIMARY_ONLY)) &&
((nLangList & LANG_LIST_ALL) != 0 || ((nLangList & LANG_LIST_ALL) != 0 ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment