From 4189b715999bf9ebb0cd04a0c610a7b514e28d1b Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Mon, 4 Aug 2014 14:05:37 +0200 Subject: 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 --- cui/source/tabpages/numfmt.cxx | 6 +++++- i18nlangtag/source/isolang/mslangid.cxx | 16 ++++++++++++++++ include/i18nlangtag/mslangid.hxx | 3 +++ svx/source/dialog/langbox.cxx | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index 452866736904..de36480db1c8 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -319,6 +320,8 @@ void SvxNumberFormatTabPage::Init_Impl() // initialize language ListBox 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 // LanguageType back to an identical Language_Country name and therefore // couldn't load the i18n LocaleData. Show DebugMsg in non-PRODUCT version. @@ -327,7 +330,8 @@ void SvxNumberFormatTabPage::Init_Impl() sal_Int32 nCount = xLang.getLength(); for ( sal_Int32 i=0; iInsertLanguage( xLang[i] ); + if (!MsLangId::isLegacy( xLang[i])) + m_pLbLanguage->InsertLanguage( xLang[i] ); } } diff --git a/i18nlangtag/source/isolang/mslangid.cxx b/i18nlangtag/source/isolang/mslangid.cxx index 6bb92bbeba0d..7f6c42f5353e 100644 --- a/i18nlangtag/source/isolang/mslangid.cxx +++ b/i18nlangtag/source/isolang/mslangid.cxx @@ -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 LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang, bool /*bUserInterfaceSelection*/ ) { diff --git a/include/i18nlangtag/mslangid.hxx b/include/i18nlangtag/mslangid.hxx index 63be1e913cfd..c629b775f695 100644 --- a/include/i18nlangtag/mslangid.hxx +++ b/include/i18nlangtag/mslangid.hxx @@ -172,6 +172,9 @@ public: static LanguageType getReplacementForObsoleteLanguage( LanguageType nLang, 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 configuration! */ diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 44aeecbc083c..2eea8f6952b7 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -267,6 +267,7 @@ void SvxLanguageBoxBase::SetLanguageList( sal_Int16 nLangList, if ( nLangType != LANGUAGE_DONTKNOW && nLangType != LANGUAGE_SYSTEM && nLangType != LANGUAGE_NONE && + !MsLangId::isLegacy( nLangType) && (MsLangId::getSubLanguage( nLangType) != 0 || (nLangList & LANG_LIST_ALSO_PRIMARY_ONLY)) && ((nLangList & LANG_LIST_ALL) != 0 || -- cgit