This module contains utility functions to get language name and details by ISO language code or vise versa
Methods
# static getLanguageDetails(languageCode, localeCodeopt) → {LanguageDetails}
Function to get various language details
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
languageCode |
string | Language identifier is a combination of sub-tags (Language[-Script][-Region]) for Language and optionally Script, and/or Region, according to BCP 47 and RFC 4647 |
||
localeCode |
string |
<optional> |
'en' | Locale/Language code to localize language information into |
details Language details
# static getLanguageName(languageCode, localeCodeopt) → {string|undefined}
Function to get language name based on ISO language code. Caches returned values by localeCode
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
languageCode |
string | 2-letter ISO 639-1 or 3-letter ISO 639-2/T or 3-letter language code, might have optional sub-tags for Script and Region that won't be used. See getLanguageDetails |
||
localeCode |
string |
<optional> |
'en' | locale/language code to localize language name into |
localized language name or undefined if there is no localization available
Type Definitions
# LanguageDetails
Properties:
Name | Type | Description |
---|---|---|
languageCode |
string | Initial normalized 2-letter ISO 639-1 or 3-letter ISO 639-2/T or 3-letter ISO 639-3 language code (without Script or Region sub-tags) |
languageName |
string | Language name localized or in English |
languageScript |
string | undefined | Script name based on 4-letter ISO-15924 script sub-tag (i.e. Cyrillic, Arabic, Latin...) |
languageRegion |
string | undefined | Region name based on 2-letter ISO 3166-1 region sub-tag (i.e. US, GB...) |
localized |
boolean | Are languageName, languageScript, languageRegion localized |
type |
string | ISO 639-3 language type (i.e. 'living', 'historical', 'constructed') |
scope |
string | ISO 639-3 language scope (i.e. 'individual', 'macrolanguage') See https://en.wikipedia.org/wiki/ISO_639:a |
iso6393 |
string | undefined | ISO 693-3 3-letter language code |
iso6392B |
string | undefined | ISO 693-2/B 3-letter language code |
iso6392T |
string | undefined | ISO 693-2/T 3-letter language code |
iso6391 |
string | undefined | ISO 693-1 2-letter language code |