added isNonLatinWestern()

Change-Id: Ie2aadab8302f365379a569989bd9640db55b9716
This commit is contained in:
Eike Rathke 2013-10-24 12:26:02 +02:00
parent 5dcee8893a
commit b796a2030b
2 changed files with 45 additions and 0 deletions

View file

@ -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;
@ -404,6 +408,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*/ )
{

View file

@ -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