Class: Locale

Locale


new Locale( [language_code])

A service for providing a localization table based on a language code configuration option

Parameters:
Name Type Argument Description
language_code string <optional>

The language to to initialize with

Members


<inner> locale :SupportedLocales

The language code for the language to provide strings from.

Type:
  • SupportedLocales
Default Value:
  • 'en'

<inner> stringMap :object

Provides a map for sets of interface strings for common locales. For example, canadian english might just use english interface strings.

Type:
  • object

<inner> strings :Object

An object for accessing common symptom checker interface strings in each supported locale. The top level key is a supported locale and the second level keys are interface strings that have snake cased key names matching the value.

Type:
  • Object

<inner> SupportedLocales

Properties:
Name Type Default Description
en 1
es 1
"en-CA" 1
"en-ZA" 1
"en-NZ" 1
"fr-CA" 1

Methods


<inner> getLocale()

Get the language code for currently set Locale

Returns:

the language code for currently set Locale

Type
SupportedLocales

<inner> getLocalized(localizedStrings)

Get the localized string coresponding to currently set Locale

Parameters:
Name Type Description
localizedStrings Object

Object containing localized strings

Returns:

the cooresponding localized string

Type
string

<inner> getStrings( [supportedLocale])

Retrieve the strings for the current locale;

Parameters:
Name Type Argument Description
supportedLocale SupportedLocales <optional>

An optional supported locale argument identifying which locale to get strings for. If not provided, it will use locale.

Returns:

An object with common interface strings.

Type
object

<inner> getSupportedLocales()

Get all of the supported Locales

Returns:

A string array providing supported locale language codes

Type
Array.<string>

<inner> setLocale(supportedLocale)

Set the locale to any supported locale. Use getStrings after setting locale to retrieve a strings object in the locale you have set.

Parameters:
Name Type Description
supportedLocale SupportedLocales

The locale you would like to set for.

Returns:

true if supported or false if there is an error.

Type
bool