Class: Compiler

Compiler

new Compiler(mf)

Creates a new message compiler. Called internally from MessageFormat#compile.

Parameters:
Name Type Description
mf MessageFormat

A MessageFormat instance

Properties:
Name Type Description
locales object

The locale identifiers that are used by the compiled functions

runtime object

Names of the core runtime functions that are used by the compiled functions

formatters object

The formatter functions that are used by the compiled functions

Source:

Methods

(static) bidiMarkText()

Utility formatter function for enforcing Bidi Structured Text by using UCC

List inlined from data extracted from CLDR v27 & v28 To verify/recreate, use the following:

git clone https://github.com/unicode-cldr/cldr-misc-full.git
cd cldr-misc-full/main/
grep characterOrder -r . | tr '"/' '\t' | cut -f2,6 | grep -C4 right-to-left
Source:

(static) funcname()

Utility function for escaping a function name iff required

Source:

(static) propname()

Utility function for quoting an Object's key value iff required

Quotes the key if it contains invalid characters or is an ECMAScript 3rd Edition reserved word (for IE8).

Source:

compile(src, lc, plurals)

Recursively compile a string or a tree of strings to JavaScript function sources

If src is an object with a key that is also present in plurals, the key in question will be used as the locale identifier for its value. To disable the compile-time checks for plural & selectordinal keys while maintaining multi-locale support, use falsy values in plurals.

Parameters:
Name Type Description
src string | object

the source for which the JS code should be generated

lc string

the default locale

plurals object

a map of pluralization keys for all available locales

Source: