summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-08-04 14:05:37 +0200
committerEike Rathke <erack@redhat.com>2014-08-04 14:24:17 +0200
commit4189b715999bf9ebb0cd04a0c610a7b514e28d1b (patch)
treefbdaa057a52553df749e3a260312bf530a5f84fc
parent955c5539a1ea5e971f111989d6c5bec11d936416 (diff)
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
-rw-r--r--cui/source/tabpages/numfmt.cxx6
-rw-r--r--i18nlangtag/source/isolang/mslangid.cxx16
-rw-r--r--include/i18nlangtag/mslangid.hxx3
-rw-r--r--svx/source/dialog/langbox.cxx1
4 files changed, 25 insertions, 1 deletions
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 <vcl/settings.hxx>
#include <unotools/localedatawrapper.hxx>
#include <i18nlangtag/lang.h>
+#include <i18nlangtag/mslangid.hxx>
#include <svx/dialogs.hrc>
#include <svtools/colorcfg.hxx>
@@ -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; i<nCount; i++ )
{
- m_pLbLanguage->InsertLanguage( 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
@@ -473,6 +473,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*/ )
{
switch (nLang)
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 ||