Skip to content

Latest commit

 

History

History
111 lines (84 loc) · 4.05 KB

u-namespace.md

File metadata and controls

111 lines (84 loc) · 4.05 KB

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:.

Unicode Namespace Options

This section describes u: options. When implemented, they apply to all functions and markup, including user-defined functions in that implementation.

u:id

Implementations providing a formatting target other than a concatenated string SHOULD support this option.

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.

For example, u:id could be used to distinguish two otherwise matching placeholders from each other:

The first number was {$a :number u:id=first} and the second {$b :number u:id=second}.

Ignored when formatting a message to a string.

The u:id option value 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 and its option value are ignored.

u:locale

Important

This option has a status of Draft. It is proposed for inclusion in a future release and is not Stable.

Implementations MAY support this option.

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 u:locale option and its option value are 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 u:locale option and option value 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

Implementations SHOULD support this option.

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 u:dir option and its option value are 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 u:dir option value MUST be one of the following literal values or a variable whose resolved value is one of the following strings:

  • 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 u:dir option and its option value are ignored.