Home

Class goog.i18n.MessageFormat

Constructor of MessageFormat.

Instance Method Summary
buildPlaceholder_(!Array literals) ⇒ string

Builds a placeholder from the last index of the array.

extractParts_(string pattern) ⇒ ?Array

Breaks pattern into strings and top level {...} blocks.

format(!Object namedParameters) ⇒ string

Formats a message, treating '#' with special meaning representing the number (plural_variable - offset).

formatBlock_(!Array parsedPattern, !Object namedParameters, boolean ignorePound, !Array result)

Parses generic block and returns a formatted string.

formatIgnoringPound(!Object namedParameters) ⇒ string

Formats a message, treating '#' as literary character.

formatPluralBlock_(!Object parsedPattern, !Object namedParameters, boolean ignorePound, !Array result)

Formats plural block. Only one option is selected and all # are replaced.

formatSelectBlock_(!Object parsedPattern, !Object namedParameters, boolean ignorePound, !Array result)

Formats select block. Only one option is selected.

formatSimplePlaceholder_(!Object parsedPattern, !Object namedParameters, !Array result)

Formats simple placeholder.

format_(!Object namedParameters, boolean ignorePound) ⇒ string

Formats a message.

insertPlaceholders_(string pattern) ⇒ string

Replaces string literals with literal placeholders. Literals are string of the form '}...', '{...' and '#...' where ... is set of characters not containing ' Builds a dictionary so we can recover literals during format phase.

parseBlockType_(string pattern) ⇒ ?goog.i18n.MessageFormat.BlockType_

Detects which type of a block is the pattern.

parseBlock_(string pattern) ⇒ !Array

Parses generic block.

parsePattern_(string pattern)

Parses input pattern into an array, for faster reformatting with different input parameters. Parsing is locale independent.

parsePluralBlock_(string pattern) ⇒ ?Object

Parses a plural type of a block and produces JSON object for it.

parseSelectBlock_(string pattern) ⇒ ?Object

Parses a select type of a block and produces JSON object for it.