LibreOffice Module i18nlangtag (master) 1
Classes | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
MsLangId Class Reference

Methods related to Microsoft language IDs. More...

#include <mslangid.hxx>

Collaboration diagram for MsLangId:
[legend]

Classes

class  Conversion
 Encapsulated conversion methods used by LanguageTag and conversions, not to be used by anything else. More...
 
class  LanguageTagAccess
 Encapsulated methods that shall only be accessed through class LanguageTag. More...
 
struct  LanguagetagMapping
 

Public Member Functions

static ::std::vector< LanguagetagMappinggetDefinedLanguagetags ()
 

Static Public Member Functions

static LanguageType makeLangID (LanguageType nSubLangId, LanguageType nPriLangId)
 Create a LangID from a primary and a sublanguage. More...
 
static LanguageType getPrimaryLanguage (LanguageType nLangID)
 Get the primary language of a LangID. More...
 
static LanguageType getSubLanguage (LanguageType nLangID)
 Get the sublanguage of a LangID. More...
 
static LanguageType getConfiguredSystemLanguage ()
 Get the configured system language/locale. More...
 
static LanguageType getConfiguredSystemUILanguage ()
 Get the configured system UI language/locale. More...
 
static LanguageType getSystemLanguage ()
 Language/locale of category LC_CTYPE (on Unix, else the system language). More...
 
static LanguageType getSystemUILanguage ()
 Language/locale of category LC_MESSAGES (on Unix, else same as getSystemLanguage()). More...
 
static LanguageType getRealLanguage (LanguageType nLang)
 : A proper language/locale if the nLang parameter designates some special value. More...
 
static css::lang::Locale getFallbackLocale (const css::lang::Locale &rLocale)
 Get fall-back Locale for Locale with handling of an empty language name designating the SYSTEM language. More...
 
static LanguageType convertUnxByteStringToLanguage (std::string_view rString)
 
static LanguageType resolveSystemLanguageByScriptType (LanguageType nLang, sal_Int16 nType)
 
static bool usesHyphenation (LanguageType nLang)
 Whether the language uses hyphenation. More...
 
static bool isRightToLeft (LanguageType nLang)
 Whether locale has a Right-To-Left orientation for text. More...
 
static bool isRightToLeftMath (LanguageType nLang)
 Whether locale has a Right-To-Left orientation for math. More...
 
static bool isCJK (LanguageType nLang)
 Whether locale is a CJK locale. More...
 
static bool isChinese (LanguageType nLang)
 Whether locale is a chinese locale. More...
 
static bool isSimplifiedChinese (LanguageType nLang)
 Whether locale is a simplified chinese locale. More...
 
static bool isTraditionalChinese (LanguageType nLang)
 Whether locale is a traditional chinese locale. More...
 
static bool isKorean (LanguageType nLang)
 Whether locale is a korean locale. More...
 
static bool isSimplifiedChinese (const css::lang::Locale &rLocale)
 Whether locale is a simplified chinese locale. More...
 
static bool isTraditionalChinese (const css::lang::Locale &rLocale)
 Whether locale is a traditional chinese locale. More...
 
static bool isFamilyNameFirst (LanguageType nLang)
 Whether locale is one where family name comes first, e.g. More...
 
static bool hasForbiddenCharacters (LanguageType nLang)
 Whether there are "forbidden characters at start or end of line" in this locale. More...
 
static bool needsSequenceChecking (LanguageType nLang)
 Whether locale needs input sequence checking. More...
 
static sal_Int16 getScriptType (LanguageType nLang)
 Get css::i18n::ScriptType of locale. More...
 
static bool isNonLatinWestern (LanguageType nLang)
 Whether locale is "Western" but not Latin script, e.g. More...
 
static LanguageType getReplacementForObsoleteLanguage (LanguageType nLang)
 Map an obsolete user defined LANGID (see lang.h LANGUAGE_OBSOLETE_USER_...) to the new value defined by MS in the meantime. More...
 
static bool isLegacy (LanguageType nLang)
 Whether locale is legacy, i.e. More...
 
static void setConfiguredSystemUILanguage (LanguageType nLang)
 @ATTENTION: these are ONLY to be called by the application's configuration! More...
 
static void setConfiguredWesternFallback (LanguageType nLang)
 
static void setConfiguredComplexFallback (LanguageType nLang)
 
static void setConfiguredAsianFallback (LanguageType nLang)
 

Static Private Member Functions

static LanguageType getPlatformSystemLanguage ()
 
static LanguageType getPlatformSystemUILanguage ()
 
static I18NLANGTAG_DLLPRIVATE LanguageType simplifySystemLanguages (LanguageType nLang)
 

Static Private Attributes

static LanguageType nConfiguredSystemLanguage = LANGUAGE_SYSTEM
 
static LanguageType nConfiguredSystemUILanguage = LANGUAGE_SYSTEM
 
static LanguageType nConfiguredWesternFallback = LANGUAGE_SYSTEM
 
static LanguageType nConfiguredAsianFallback = LANGUAGE_SYSTEM
 
static LanguageType nConfiguredComplexFallback = LANGUAGE_SYSTEM
 

Detailed Description

Methods related to Microsoft language IDs.

For details about MS-LANGIDs please see lang.h

Definition at line 39 of file mslangid.hxx.

Member Function Documentation

◆ convertUnxByteStringToLanguage()

LanguageType MsLangId::convertUnxByteStringToLanguage ( std::string_view  rString)
static

◆ getConfiguredSystemLanguage()

LanguageType MsLangId::getConfiguredSystemLanguage ( )
static

Get the configured system language/locale.

If not set yet then getSystemLanguage().

Prefer this over getSystemLanguage() unless you exactly know why you would not.

Definition at line 101 of file mslangid.cxx.

References getSystemLanguage(), LANGUAGE_SYSTEM, nConfiguredSystemLanguage, and SAL_WARN.

Referenced by getRealLanguage().

◆ getConfiguredSystemUILanguage()

LanguageType MsLangId::getConfiguredSystemUILanguage ( )
static

Get the configured system UI language/locale.

If not set yet then getSystemUILanguage().

Prefer this over getSystemUILanguage() unless you exactly know why you would not.

Definition at line 111 of file mslangid.cxx.

References getSystemUILanguage(), LANGUAGE_SYSTEM, nConfiguredSystemUILanguage, and SAL_WARN.

Referenced by getRealLanguage().

◆ getDefinedLanguagetags()

std::vector< MsLangId::LanguagetagMapping > MsLangId::getDefinedLanguagetags ( )

Definition at line 1516 of file isolang.cxx.

References aImplBcp47CountryEntries, aImplIsoLangEntries, and aImplIsoLangScriptEntries.

Referenced by getKnowns().

◆ getFallbackLocale()

css::lang::Locale MsLangId::getFallbackLocale ( const css::lang::Locale &  rLocale)
static

Get fall-back Locale for Locale with handling of an empty language name designating the SYSTEM language.

Returns the same Locale if an exact match was found.

Definition at line 226 of file mslangid.cxx.

References MsLangId::Conversion::convertLanguageToLocale(), LANGUAGE_SYSTEM, and MsLangId::Conversion::lookupFallbackLocale().

◆ getPlatformSystemLanguage()

LanguageType MsLangId::getPlatformSystemLanguage ( )
staticprivate

◆ getPlatformSystemUILanguage()

LanguageType MsLangId::getPlatformSystemUILanguage ( )
staticprivate

◆ getPrimaryLanguage()

static LanguageType MsLangId::getPrimaryLanguage ( LanguageType  nLangID)
inlinestatic

◆ getRealLanguage()

LanguageType MsLangId::getRealLanguage ( LanguageType  nLang)
static

: A proper language/locale if the nLang parameter designates some special value.

@descr: NOTE: The "system" values may be overridden by the application's configuration.

Returns
case LANGUAGE_PROCESS_OR_USER_DEFAULT : configured or system language case LANGUAGE_SYSTEM_DEFAULT : configured or system language case LANGUAGE_SYSTEM : configured or system language case LANGUAGE_HID_HUMAN_INTERFACE_DEVICE : configured or system UI language case LANGUAGE_DONTKNOW : LANGUAGE_ENGLISH_US else: nLang

In case the configured language is LANGUAGE_SYSTEM, which is also the initial default, the system language is obtained. In case the configured or resulting system language is LANGUAGE_DONTKNOW, LANGUAGE_ENGLISH_US is returned instead.

Definition at line 81 of file mslangid.cxx.

References getConfiguredSystemLanguage(), getConfiguredSystemUILanguage(), LANGUAGE_DONTKNOW, LANGUAGE_ENGLISH_US, LANGUAGE_HID_HUMAN_INTERFACE_DEVICE, LANGUAGE_SYSTEM, and simplifySystemLanguages().

Referenced by LanguageTagImpl::canonicalize(), LanguageTagImpl::convertBcp47ToLang(), LanguageTagImpl::convertLangToLocale(), MsLangId::Conversion::convertLanguageToLocale(), LanguageTagImpl::convertLocaleToLang(), lcl_isSystem(), LanguageTag::registerImpl(), and resolveSystemLanguageByScriptType().

◆ getReplacementForObsoleteLanguage()

LanguageType MsLangId::getReplacementForObsoleteLanguage ( LanguageType  nLang)
static

Map an obsolete user defined LANGID (see lang.h LANGUAGE_OBSOLETE_USER_...) to the new value defined by MS in the meantime.

Also used to map UI localizations using reserved ISO codes to something "official" but not identical in order to not pollute documents with invalid ISO codes.

Definition at line 530 of file mslangid.cxx.

References LANGUAGE_BRETON_FRANCE, LANGUAGE_CATALAN_VALENCIAN, LANGUAGE_DZONGKHA_BHUTAN, LANGUAGE_GAELIC_SCOTLAND, LANGUAGE_GAELIC_SCOTLAND_LEGACY, LANGUAGE_KALAALLISUT_GREENLAND, LANGUAGE_KINYARWANDA_RWANDA, LANGUAGE_KURDISH_ARABIC_IRAQ, LANGUAGE_LATIN, LANGUAGE_LOWER_SORBIAN_GERMANY, LANGUAGE_LUXEMBOURGISH_LUXEMBOURG, LANGUAGE_MALAGASY_PLATEAU, LANGUAGE_MAORI_NEW_ZEALAND, LANGUAGE_NORWEGIAN, LANGUAGE_NORWEGIAN_BOKMAL, LANGUAGE_OBSOLETE_USER_BRETON, LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN, LANGUAGE_OBSOLETE_USER_KABYLE, LANGUAGE_OBSOLETE_USER_KALAALLISUT, LANGUAGE_OBSOLETE_USER_KINYARWANDA, LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ, LANGUAGE_OBSOLETE_USER_LATIN, LANGUAGE_OBSOLETE_USER_LATIN_VATICAN, LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN, LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH, LANGUAGE_OBSOLETE_USER_MALAGASY_PLATEAU, LANGUAGE_OBSOLETE_USER_MAORI, LANGUAGE_OBSOLETE_USER_OCCITAN, LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_MONTENEGRO, LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_SERBIA, LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_MONTENEGRO, LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_SERBIA, LANGUAGE_OBSOLETE_USER_SPANISH_CUBA, LANGUAGE_OBSOLETE_USER_SPANISH_LATIN_AMERICA, LANGUAGE_OBSOLETE_USER_TSWANA_BOTSWANA, LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN, LANGUAGE_OCCITAN_FRANCE, LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO, LANGUAGE_SERBIAN_CYRILLIC_SERBIA, LANGUAGE_SERBIAN_LATIN_MONTENEGRO, LANGUAGE_SERBIAN_LATIN_SERBIA, LANGUAGE_SPANISH_CUBA, LANGUAGE_SPANISH_LATIN_AMERICA, LANGUAGE_TAMAZIGHT_LATIN_ALGERIA, LANGUAGE_TIBETAN_BHUTAN, LANGUAGE_TSWANA_BOTSWANA, LANGUAGE_UPPER_SORBIAN_GERMANY, LANGUAGE_USER_ENGLISH_UK_OED, and LANGUAGE_USER_ENGLISH_UK_OXENDICT.

◆ getScriptType()

sal_Int16 MsLangId::getScriptType ( LanguageType  nLang)
static

Get css::i18n::ScriptType of locale.

Definition at line 365 of file mslangid.cxx.

References o3tl::strong_int< typename UNDERLYING_TYPE, typename PHANTOM_TYPE >::anyOf(), LanguageTag::CJK, LanguageTag::CTL, LanguageTag::getOnTheFlyScriptType(), LanguageTag::isOnTheFlyID(), LANGUAGE_AMHARIC_ETHIOPIA, LANGUAGE_ARABIC_SAUDI_ARABIA, LANGUAGE_ASSAMESE, LANGUAGE_BENGALI, LANGUAGE_BURMESE, LANGUAGE_CHINESE, LANGUAGE_DHIVEHI, LANGUAGE_FARSI, LANGUAGE_GUJARATI, LANGUAGE_HEBREW, LANGUAGE_HINDI, LANGUAGE_JAPANESE, LANGUAGE_KANNADA, LANGUAGE_KASHMIRI, LANGUAGE_KHMER, LANGUAGE_KONKANI, LANGUAGE_KOREAN, LANGUAGE_KURDISH_ARABIC_IRAQ, LANGUAGE_KURDISH_ARABIC_LSO, LANGUAGE_LAO, LANGUAGE_MALAYALAM, LANGUAGE_MANIPURI, LANGUAGE_MARATHI, LANGUAGE_MONGOLIAN_CYRILLIC_LSO, LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA, LANGUAGE_MONGOLIAN_MONGOLIAN_CHINA, LANGUAGE_MONGOLIAN_MONGOLIAN_LSO, LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA, LANGUAGE_NEPALI, LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ, LANGUAGE_ODIA, LANGUAGE_PUNJABI, LANGUAGE_SANSKRIT, LANGUAGE_SINDHI, LANGUAGE_SINHALESE_SRI_LANKA, LANGUAGE_SYRIAC, LANGUAGE_TAMIL, LANGUAGE_TELUGU, LANGUAGE_THAI, LANGUAGE_TIBETAN, LANGUAGE_TIGRIGNA_ETHIOPIA, LANGUAGE_UIGHUR_CHINA, LANGUAGE_URDU_INDIA, LANGUAGE_USER_BODO_INDIA, LANGUAGE_USER_DOGRI_INDIA, LANGUAGE_USER_HUNGARIAN_ROVAS, LANGUAGE_USER_KURDISH_IRAN, LANGUAGE_USER_KURDISH_SOUTHERN_IRAN, LANGUAGE_USER_KURDISH_SOUTHERN_IRAQ, LANGUAGE_USER_KURDISH_SYRIA, LANGUAGE_USER_KURDISH_TURKEY, LANGUAGE_USER_KYRGYZ_CHINA, LANGUAGE_USER_LIMBU, LANGUAGE_USER_MAITHILI_INDIA, LANGUAGE_USER_MALAY_ARABIC_BRUNEI, LANGUAGE_USER_MALAY_ARABIC_MALAYSIA, LANGUAGE_USER_MANCHU, LANGUAGE_USER_NKO, LANGUAGE_USER_PALI_THAI, LANGUAGE_USER_ROHINGYA_HANIFI, LANGUAGE_USER_SARAIKI, LANGUAGE_USER_XIBE, LANGUAGE_YIDDISH, LANGUAGE_YUE_CHINESE_HONGKONG, primary(), LanguageTag::RTL, LanguageTag::UNKNOWN, and LanguageTag::WESTERN.

Referenced by isNonLatinWestern(), and resolveSystemLanguageByScriptType().

◆ getSubLanguage()

static LanguageType MsLangId::getSubLanguage ( LanguageType  nLangID)
inlinestatic

Get the sublanguage of a LangID.

Definition at line 56 of file mslangid.hxx.

References LANGUAGE_MASK_PRIMARY.

Referenced by getNextOnTheFlyLanguage(), and LanguageTag::isOnTheFlyID().

◆ getSystemLanguage()

LanguageType MsLangId::getSystemLanguage ( )
static

Language/locale of category LC_CTYPE (on Unix, else the system language).

Evaluation order: LC_ALL, LC_CTYPE, LANG Note this may return an unknown unsupported locale.

Definition at line 121 of file mslangid.cxx.

References getPlatformSystemLanguage().

Referenced by getConfiguredSystemLanguage().

◆ getSystemUILanguage()

LanguageType MsLangId::getSystemUILanguage ( )
static

Language/locale of category LC_MESSAGES (on Unix, else same as getSystemLanguage()).

Evaluation order: LANGUAGE, LC_ALL, LC_MESSAGES, LANG Note this may return an unknown unsupported locale.

Definition at line 128 of file mslangid.cxx.

References getPlatformSystemUILanguage().

Referenced by getConfiguredSystemUILanguage().

◆ hasForbiddenCharacters()

bool MsLangId::hasForbiddenCharacters ( LanguageType  nLang)
static

Whether there are "forbidden characters at start or end of line" in this locale.

CJK locales.

See also
offapi/com/sun/star/i18n/ForbiddenCharacters.idl

Definition at line 345 of file mslangid.cxx.

References isCJK().

◆ isChinese()

bool MsLangId::isChinese ( LanguageType  nLang)
static

Whether locale is a chinese locale.

Definition at line 310 of file mslangid.cxx.

References getPrimaryLanguage(), LANGUAGE_CHINESE, and LANGUAGE_YUE_CHINESE_HONGKONG.

Referenced by isSimplifiedChinese().

◆ isCJK()

bool MsLangId::isCJK ( LanguageType  nLang)
static

◆ isFamilyNameFirst()

bool MsLangId::isFamilyNameFirst ( LanguageType  nLang)
static

Whether locale is one where family name comes first, e.g.

Japan, Hungary, Samoa

Definition at line 339 of file mslangid.cxx.

References isCJK(), and LANGUAGE_HUNGARIAN.

◆ isKorean()

bool MsLangId::isKorean ( LanguageType  nLang)
static

Whether locale is a korean locale.

Definition at line 317 of file mslangid.cxx.

References getPrimaryLanguage(), and LANGUAGE_KOREAN.

◆ isLegacy()

bool MsLangId::isLegacy ( LanguageType  nLang)
static

Whether locale is legacy, i.e.

country or confederation doesn't exist anymore.

Definition at line 518 of file mslangid.cxx.

References o3tl::strong_int< typename UNDERLYING_TYPE, typename PHANTOM_TYPE >::anyOf(), LANGUAGE_SERBIAN_CYRILLIC_SAM, and LANGUAGE_SERBIAN_LATIN_SAM.

◆ isNonLatinWestern()

bool MsLangId::isNonLatinWestern ( LanguageType  nLang)
static

◆ isRightToLeft()

bool MsLangId::isRightToLeft ( LanguageType  nLang)
static

◆ isRightToLeftMath()

bool MsLangId::isRightToLeftMath ( LanguageType  nLang)
static

Whether locale has a Right-To-Left orientation for math.

Definition at line 274 of file mslangid.cxx.

References isRightToLeft(), LANGUAGE_ARABIC_MOROCCO, and LANGUAGE_FARSI.

◆ isSimplifiedChinese() [1/2]

bool MsLangId::isSimplifiedChinese ( const css::lang::Locale &  rLocale)
static

Whether locale is a simplified chinese locale.

Definition at line 289 of file mslangid.cxx.

References isTraditionalChinese().

◆ isSimplifiedChinese() [2/2]

bool MsLangId::isSimplifiedChinese ( LanguageType  nLang)
static

Whether locale is a simplified chinese locale.

Definition at line 283 of file mslangid.cxx.

References isChinese(), and isTraditionalChinese().

◆ isTraditionalChinese() [1/2]

bool MsLangId::isTraditionalChinese ( const css::lang::Locale &  rLocale)
static

Whether locale is a traditional chinese locale.

Definition at line 304 of file mslangid.cxx.

◆ isTraditionalChinese() [2/2]

bool MsLangId::isTraditionalChinese ( LanguageType  nLang)
static

◆ makeLangID()

static LanguageType MsLangId::makeLangID ( LanguageType  nSubLangId,
LanguageType  nPriLangId 
)
inlinestatic

Create a LangID from a primary and a sublanguage.

Definition at line 44 of file mslangid.hxx.

Referenced by getNextOnTheFlyLanguage().

◆ needsSequenceChecking()

bool MsLangId::needsSequenceChecking ( LanguageType  nLang)
static

Whether locale needs input sequence checking.

CTL locales.

Definition at line 352 of file mslangid.cxx.

References o3tl::strong_int< typename UNDERLYING_TYPE, typename PHANTOM_TYPE >::anyOf(), LANGUAGE_BURMESE, LANGUAGE_KHMER, LANGUAGE_LAO, LANGUAGE_THAI, LANGUAGE_USER_PALI_THAI, and primary().

◆ resolveSystemLanguageByScriptType()

LanguageType MsLangId::resolveSystemLanguageByScriptType ( LanguageType  nLang,
sal_Int16  nType 
)
static

◆ setConfiguredAsianFallback()

void MsLangId::setConfiguredAsianFallback ( LanguageType  nLang)
static

Definition at line 59 of file mslangid.cxx.

References nConfiguredAsianFallback.

◆ setConfiguredComplexFallback()

void MsLangId::setConfiguredComplexFallback ( LanguageType  nLang)
static

Definition at line 65 of file mslangid.cxx.

References nConfiguredComplexFallback.

◆ setConfiguredSystemUILanguage()

void MsLangId::setConfiguredSystemUILanguage ( LanguageType  nLang)
static

@ATTENTION: these are ONLY to be called by the application's configuration!

Definition at line 47 of file mslangid.cxx.

References nConfiguredSystemUILanguage.

◆ setConfiguredWesternFallback()

void MsLangId::setConfiguredWesternFallback ( LanguageType  nLang)
static

Definition at line 53 of file mslangid.cxx.

References nConfiguredWesternFallback.

◆ simplifySystemLanguages()

LanguageType MsLangId::simplifySystemLanguages ( LanguageType  nLang)
inlinestaticprivate

◆ usesHyphenation()

bool MsLangId::usesHyphenation ( LanguageType  nLang)
static

Member Data Documentation

◆ nConfiguredAsianFallback

LanguageType MsLangId::nConfiguredAsianFallback = LANGUAGE_SYSTEM
staticprivate

Definition at line 326 of file mslangid.hxx.

Referenced by resolveSystemLanguageByScriptType(), and setConfiguredAsianFallback().

◆ nConfiguredComplexFallback

LanguageType MsLangId::nConfiguredComplexFallback = LANGUAGE_SYSTEM
staticprivate

◆ nConfiguredSystemLanguage

LanguageType MsLangId::nConfiguredSystemLanguage = LANGUAGE_SYSTEM
staticprivate

◆ nConfiguredSystemUILanguage

LanguageType MsLangId::nConfiguredSystemUILanguage = LANGUAGE_SYSTEM
staticprivate

Definition at line 323 of file mslangid.hxx.

Referenced by getConfiguredSystemUILanguage(), and setConfiguredSystemUILanguage().

◆ nConfiguredWesternFallback

LanguageType MsLangId::nConfiguredWesternFallback = LANGUAGE_SYSTEM
staticprivate

The documentation for this class was generated from the following files: