Skip to content

Latest commit

 

History

History
92 lines (70 loc) · 3.44 KB

u-namespace.md

File metadata and controls

92 lines (70 loc) · 3.44 KB

MessageFormat 2.0 Unicode Namespace

The u: namespace is reserved for the definition of options which affect the function context of the specific expressions in which they appear, or for the definition of options that are universally applicable rather than function-specific. It might also be used to define functions in a future release.

The CLDR Technical Committee of the Unicode Consortium manages the specification for this namespace, hence the namespace u:.

Options

This section describes common u: options which each implementation SHOULD support for all functions and markup.

u:id

A string value that is included as an id or other suitable value in the formatted parts for the placeholder, or any other structured formatted results.

Ignored when formatting a message to a string.

The value of the u:id option MUST be a literal or a variable whose resolved value is either a string or can be resolved to a string without error. For other values, a Bad Option error is emitted and the u:id option is ignored.

u:locale

Replaces the locale defined in the function context for this expression.

A comma-delimited list consisting of well-formed BCP 47 language tags, or an implementation-defined list of such tags.

If this option is set on markup, a Bad Option error is emitted and the value of the u:locale option is ignored.

During processing, the u:locale option MUST be removed from the resolved mapping of options before calling the function handler.

Values matching the following ABNF are always accepted:

u-locale-option = unicode_bcp47_locale_id *(o "," o unicode_bcp47_locale_id)

using unicode_bcp47_locale_id as defined for Unicode Locale Identifier.

Implementations MAY support additional language tags, such as private-use or grandfathered tags, or tags using _ instead of - as a separator. When the value of u:locale is set by a variable, implementations MAY support non-string values otherwise representing locales.

Implementations MAY emit a Bad Option error and MAY ignore the value of the u:locale option as a whole or any of the entries in the list of language tags. This might be because the locale specified is not supported or because the language tag is not well-formed, not valid, or some other reason.

u:dir

Replaces the base directionality defined in the function context for this expression and applies bidirectional isolation to it.

If this option is set on markup, a Bad Option error is emitted and the value of the u:dir option is ignored.

During processing, the u:dir option MUST be removed from the resolved mapping of options before calling the function handler. Its value is retained in the resolved value of the expression.

The value of the u:dir option MUST be one of the following literal values or a variable whose resolved value is one of these literals:

  • ltr: left-to-right directionality
  • rtl: right-to-left directionality
  • auto: directionality determined from expression contents
  • inherit (default): directionality inherited from the message or from the resolved value of the operand without requiring isolation of the expression value.

For other values, a Bad Option error is emitted and the value of the u:dir option is ignored.