Namespace: runtime

MessageFormat#runtime

A set of utility functions that are called by the compiled Javascript functions, these are included locally in the output of compile().

Source:

Members

fmt :Object.<string, function()>

Custom formatting functions called by {var, fn[, args]*} syntax

For examples, see MessageFormat.formatters

Type:
  • Object.<string, function()>
Source:
See:

pluralFuncs :Object.<string, function()>

Pluralization functions included in compiled output

Type:
  • Object.<string, function()>
Source:

Methods

(static) number(value, offsetopt)

Utility function for # in plural rules

Parameters:
Name Type Attributes Default Description
value number

The value to operate on

offset number <optional>
0

An optional offset, set by the surrounding context

Source:

(static) plural(value, offset, lcfunc, data, isOrdinalnullable) → {string}

Utility function for {N, plural|selectordinal, ...}

Parameters:
Name Type Attributes Description
value number

The key to use to find a pluralization rule

offset number

An offset to apply to value

lcfunc function

A locale function from pluralFuncs

data Object.<string, string>

The object from which results are looked up

isOrdinal boolean <nullable>

If true, use ordinal rather than cardinal rules

Source:
Returns:

The result of the pluralization

Type
string

(static) select(value, data) → {string}

Utility function for {N, select, ...}

Parameters:
Name Type Description
value number

The key to use to find a selection

data Object.<string, string>

The object from which results are looked up

Source:
Returns:

The result of the select statement

Type
string

toString()

Custom stringifier to clean up browser inconsistencies

Source: