[Libreoffice-commits] core.git: i18nlangtag/source include/i18nlangtag
Eike Rathke
erack at redhat.com
Thu Oct 24 03:37:00 PDT 2013
i18nlangtag/source/isolang/mslangid.cxx | 42 ++++++++++++++++++++++++++++++++
include/i18nlangtag/mslangid.hxx | 3 ++
2 files changed, 45 insertions(+)
New commits:
commit b796a2030b9814978c904979dc609422d08eb538
Author: Eike Rathke <erack at redhat.com>
Date: Thu Oct 24 12:26:02 2013 +0200
added isNonLatinWestern()
Change-Id: Ie2aadab8302f365379a569989bd9640db55b9716
diff --git a/i18nlangtag/source/isolang/mslangid.cxx b/i18nlangtag/source/isolang/mslangid.cxx
index 72d5051..a48693b 100644
--- a/i18nlangtag/source/isolang/mslangid.cxx
+++ b/i18nlangtag/source/isolang/mslangid.cxx
@@ -24,6 +24,10 @@
#include "i18nlangtag/mslangid.hxx"
+// Only very limited few functions that are guaranteed to not be called from
+// LanguageTag may use LanguageTag ...
+#include "i18nlangtag/languagetag.hxx"
+
LanguageType MsLangId::nConfiguredSystemLanguage = LANGUAGE_SYSTEM;
LanguageType MsLangId::nConfiguredSystemUILanguage = LANGUAGE_SYSTEM;
@@ -405,6 +409,44 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang )
// static
+bool MsLangId::isNonLatinWestern( LanguageType nLang )
+{
+ switch (nLang)
+ {
+ case LANGUAGE_AZERI_CYRILLIC:
+ case LANGUAGE_AZERI_CYRILLIC_LSO:
+ case LANGUAGE_BELARUSIAN:
+ case LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA:
+ case LANGUAGE_BOSNIAN_CYRILLIC_LSO:
+ case LANGUAGE_BULGARIAN:
+ case LANGUAGE_GREEK:
+ case LANGUAGE_MONGOLIAN_CYRILLIC_LSO:
+ case LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA:
+ case LANGUAGE_RUSSIAN:
+ case LANGUAGE_RUSSIAN_MOLDOVA:
+ case LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA:
+ case LANGUAGE_SERBIAN_CYRILLIC_LSO:
+ case LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO:
+ case LANGUAGE_SERBIAN_CYRILLIC_SAM:
+ case LANGUAGE_SERBIAN_CYRILLIC_SERBIA:
+ case LANGUAGE_UKRAINIAN:
+ case LANGUAGE_UZBEK_CYRILLIC:
+ case LANGUAGE_UZBEK_CYRILLIC_LSO:
+ return true;
+ default:
+ {
+ if (getScriptType( nLang) != com::sun::star::i18n::ScriptType::LATIN)
+ return false;
+ LanguageTag aLanguageTag( nLang);
+ if (aLanguageTag.hasScript())
+ return aLanguageTag.getScript() != "Latn";
+ }
+ }
+ 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 e0582d8..c35996c 100644
--- a/include/i18nlangtag/mslangid.hxx
+++ b/include/i18nlangtag/mslangid.hxx
@@ -148,6 +148,9 @@ public:
/** Get ::com::sun::star::i18n::ScriptType of locale. */
static sal_Int16 getScriptType( LanguageType nLang );
+ /** Whether locale is "Western" but not Latin script, e.g. Cyrillic or Greek. */
+ static bool isNonLatinWestern( LanguageType nLang );
+
/** Map an obsolete user defined LANGID (see lang.h
LANGUAGE_OBSOLETE_USER_...) to the new value defined by MS in the
More information about the Libreoffice-commits
mailing list