Module: locale_js

Methods

(inner) checkSmartCount(number) → {number}

Checks for singular or plural
Parameters:
Name Type Description
number number number to check
Source:
Returns:
0 = singular, 1 = plural
Type
number

(inner) fmtDate(secs) → {string}

Returns timestamp as formatted date string
Parameters:
Name Type Description
secs number unix timestamp
Source:
Returns:
formatted date
Type
string

(inner) fmtDuration(secs) → {string}

Returns seconds as formatted duration string
Parameters:
Name Type Description
secs number duration to format
Source:
Returns:
formatted duration
Type
string

(inner) fmtSongDuration(secs) → {string}

Returns seconds as formatted song duration string
Parameters:
Name Type Description
secs number duration to format
Source:
Returns:
formatted song duration
Type
string

(inner) fmtTime(secs) → {string}

Returns timestamp as formatted time string
Parameters:
Name Type Description
secs number unix timestamp
Source:
Returns:
formatted date
Type
string

(inner) i18nHtml(root) → {void}

Translates all phrases in the dom
Parameters:
Name Type Description
root HTMLElement root element to translate
Source:
Returns:
Type
void

(inner) i18nPregenerated() → {void}

Set translations for pregenerated elements
Source:
Returns:
Type
void

(inner) setLocale(newLocale) → {void}

Sets and fetches the locale and translates the dom
Parameters:
Name Type Description
newLocale string locale to set
Source:
Returns:
Type
void

(inner) tn(phrase, dataopt) → {string}

Translates the phrase and resolves variables Variables are in the format %{name} Phrase can include singular and plural separated by |||| Singular or plural is detected by the special data key smartCount
Parameters:
Name Type Attributes Description
phrase string the prase to translate
data object <optional>
variable data
Source:
Returns:
translated phrase
Type
string