messageformat package
Classes
Class | Description |
---|---|
MessageDataModelError | (BETA) Errors in the message data model. |
MessageError | (BETA) Base error class used by MessageFormat |
MessageFormat | (BETA) Create a new message formatter. |
MessageResolutionError | (BETA) Message runtime resolution errors |
MessageSelectionError | (BETA) Errors in message selection. |
MessageSyntaxError | (BETA) Errors in the message syntax. |
Functions
Function | Description |
---|---|
isCatchallKey(key) | (BETA) |
isExpression(part) | (BETA) |
isFunctionAnnotation(part) | (BETA) |
isLiteral(part) | (BETA) |
isMarkup(part) | (BETA) |
isMessage(msg) | (BETA) |
isPatternMessage(msg) | (BETA) |
isSelectMessage(msg) | (BETA) |
isUnsupportedAnnotation(part) | (BETA) |
isVariableRef(part) | (BETA) |
messageFromCST(msg) | (BETA) Convert a CST message structure into its data model representation. |
parseCST(source, opt) | (BETA) Parse the string syntax representation of a message into its corresponding CST representation. |
parseMessage(source, opt) | <p>A MessageFormat 2 parser for message formatting.</p><p>Parses the source syntax representation of a message into its corresponding data model representation. Throws on syntax errors, but does not check for data model errors.</p> |
stringifyCST(cst) | (BETA) Stringify a message CST. Does not perform any error checking or validation. |
stringifyMessage(msg) | (BETA) Stringify a message using its syntax representation. |
validate(msg, onError) | (BETA) Ensure that the msg data model is _valid_, calling onError on errors. |
visit(msg, visitors) | (BETA) Apply visitor functions to message nodes. |
Interfaces
Interface | Description |
---|---|
Attribute | (BETA) The attributes of Expression and Markup are expressed as key /value pairs to allow their order to be maintained. |
CatchallKey | (BETA) The catch-all key matches all values. |
FunctionAnnotation | (BETA) To resolve a FunctionAnnotation, an externally defined function is called. |
InputDeclaration | (BETA) |
Literal | (BETA) An immediately defined value. |
LocalDeclaration | (BETA) |
Markup | (BETA) Markup placeholders can span ranges of other pattern elements, or represent other inline elements. |
MessageDateTimePart | (BETA) |
MessageExpressionPart | (BETA) |
MessageFallbackPart | (BETA) |
MessageFormatOptions | (BETA) |
MessageFunctions | (BETA) The runtime function registry available when resolving FunctionAnnotation elements. |
MessageLiteralPart | (BETA) |
MessageMarkupPart | (BETA) |
MessageNumberPart | (BETA) |
MessageStringPart | (BETA) |
MessageUnknownPart | (BETA) |
Option | (BETA) The options of FunctionAnnotation and Markup are expressed as key /value pairs to allow their order to be maintained. |
PatternMessage | (BETA) A single message with no variants. |
SelectMessage | (BETA) SelectMessage generalises the plural, selectordinal and select argument types of MessageFormat 1. Each case is defined by a key of one or more string identifiers, and selection between them is made according to the values of a corresponding number of expressions. Selection iterates among the variants in order, and terminates when all of the Variant keys match. The result of the selection is always a single Pattern. |
UnsupportedAnnotation | (BETA) When the parser encounters an expression with reserved syntax, it emits an UnsupportedAnnotation to represent it. |
UnsupportedStatement | (BETA) |
VariableRef | (BETA) The value of a VariableRef is defined by the current Scope. |
Variant | (BETA) |
Namespaces
Namespace | Description |
---|---|
CST |
Variables
Variable | Description |
---|---|
cst | (BETA) Shared symbol used as a key on message data model nodes to reference their CST source. |
Type Aliases
Type Alias | Description |
---|---|
Declaration | (BETA) A message may declare any number of input and local variables, each with a value defined by an expression. The variable name for each declaration must be unique. |
Expression | (BETA) Expressions are used in declarations, as selectors, and as placeholders. Each must include at least an arg or an annotation , or both. |
Message | (BETA) The representation of a single message. The shape of the message is an implementation detail, and may vary for the same message in different languages. |
MessageNode | (BETA) A node in a message data model |
MessageParserOptions | |
MessagePart | (BETA) |
Pattern | (BETA) The body of each message is composed of a sequence of parts, some of them fixed (Text), others placeholders for values depending on additional data. |