[Libreoffice-commits] core.git: cui/source i18nlangtag/source include/i18nlangtag svx/source
Eike Rathke
erack at redhat.com
Mon Aug 4 05:25:00 PDT 2014
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(-)
New commits:
commit 4189b715999bf9ebb0cd04a0c610a7b514e28d1b
Author: Eike Rathke <erack at redhat.com>
Date: Mon Aug 4 14:05:37 2014 +0200
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
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index 4528667..de36480 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 6bb92bb..7f6c42f 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 63be1e9..c629b77 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 44aeecb..2eea8f6 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 ||
More information about the Libreoffice-commits
mailing list