localeUtils

Members

(inner, constant) languages :array

Lookup table of often used languages

Source:
Type:
  • array

Methods

(inner) extractLanguageFromLocale(locale) → {string}

Splits a locale into language and region but only returns language

Source:
Parameters:
Name Type Description
locale string

a string of language_region for example: "en_GB"

Returns:
Type:
string

the language part of a locale

(inner) extractRegionFromLocale(locale) → {string}

Splits a locale into language and region but only returns language

Source:
Parameters:
Name Type Description
locale string

a string of language_region for example: "en_GB"

Returns:
Type:
string

the language part of a locale

(inner) lookupCountry(timezone, locale) → {string}

First try timezone, if it fails try locale, if that fails use default

Source:
Parameters:
Name Type Description
timezone String

of the user from FB

locale string

a language_region string for example: "en_GB"

Returns:
Type:
string

name of a country

(inner) lookupISO6391(language) → {string}

Source:
Parameters:
Name Type Description
language string

the language you want to look up

Returns:
Type:
string

an ISO6391 language code string

(inner) lookupISO6392(language) → {string}

Source:
Parameters:
Name Type Description
language string

the language you want to look up

Returns:
Type:
string

an ISO6392 language code string

(inner) pickLanguage(locale, timezone) → {String}

First try locale, if it fails try timezone, if that fails use default

Source:
Parameters:
Name Type Description
locale String

of the user from FB

timezone String

of the user from FB

Returns:
Type:
String

language as a ISO6392 string

(inner) regionByTimeZone(timezone) → {String}

Get the region for a specific timezone

Source:
Parameters:
Name Type Description
timezone Integer

The timezone of the user runs from 0 to 12

Returns:
Type:
String

the region that the user is in