|
| 1 | +# MessageFormat 2.0 Unicode Namespace |
| 2 | + |
| 3 | +The `u:` _namespace_ is reserved for the definition of _options_ |
| 4 | +which affect the _function context_ of the specific _expressions_ |
| 5 | +in which they appear, |
| 6 | +or for the definition of _options_ that are universally applicable |
| 7 | +rather than function-specific. |
| 8 | +It might also be used to define _functions_ in a future release. |
| 9 | + |
| 10 | +The CLDR Technical Committee of the Unicode Consortium |
| 11 | +manages the specification for this namespace, hence the name `u:`. |
| 12 | + |
| 13 | +## Options |
| 14 | + |
| 15 | +This section describes common **_<dfn>`u:` options</dfn>_** which each implementation SHOULD support |
| 16 | +for all _functions_ and _markup_. |
| 17 | + |
| 18 | +### `u:id` |
| 19 | + |
| 20 | +A string value that is included as an `id` or other suitable value |
| 21 | +in the formatted parts for the _placeholder_, |
| 22 | +or any other structured formatted results. |
| 23 | + |
| 24 | +Ignored when formatting a message to a string. |
| 25 | + |
| 26 | +The value of the `u:id` _option_ MUST be a _literal_ or a |
| 27 | +_variable_ whose _resolved value_ is either a string |
| 28 | +or can be resolved to a string without error. |
| 29 | +For other values, a _Bad Option_ error is emitted |
| 30 | +and the `u:id` option is ignored. |
| 31 | + |
| 32 | +### `u:locale` |
| 33 | + |
| 34 | +Replaces the _locale_ defined in the _function context_ for this _expression_. |
| 35 | + |
| 36 | +A comma-delimited list consisting of |
| 37 | +well-formed [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) |
| 38 | +language tags, |
| 39 | +or an implementation-defined list of such tags. |
| 40 | + |
| 41 | +If this option is set on _markup_, a _Bad Option_ error is emitted |
| 42 | +and the value of the `u:locale` option is ignored. |
| 43 | + |
| 44 | +During processing, the `u:locale` option |
| 45 | +MUST be removed from the resolved mapping of _options_ |
| 46 | +before calling the _function handler_. |
| 47 | + |
| 48 | +Values matching the following ABNF are always accepted: |
| 49 | +```abnf |
| 50 | +u-locale-option = unicode_bcp47_locale_id *(o "," o unicode_bcp47_locale_id) |
| 51 | +``` |
| 52 | +using `unicode_bcp47_locale_id` as defined for |
| 53 | +[Unicode Locale Identifier](https://cldr-smoke.unicode.org/spec/main/ldml/tr35.html#unicode_bcp47_locale_id). |
| 54 | + |
| 55 | +Implementations MAY support additional language tags, |
| 56 | +such as private-use or grandfathered tags, |
| 57 | +or tags using `_` instead of `-` as a separator. |
| 58 | +When the value of `u:locale` is set by a _variable_, |
| 59 | +implementations MAY support non-string values otherwise representing locales. |
| 60 | + |
| 61 | +Implementations MAY emit a _Bad Option_ error |
| 62 | +and MAY ignore the value of the `u:locale` _option_ as a whole |
| 63 | +or any of the entries in the list of language tags. |
| 64 | +This might be because the locale specified is not supported |
| 65 | +or because the language tag is not well-formed, |
| 66 | +not valid, or some other reason. |
| 67 | + |
| 68 | +### `u:dir` |
| 69 | + |
| 70 | +Replaces the base directionality defined in |
| 71 | +the _function context_ for this _expression_. |
| 72 | + |
| 73 | +If this option is set on _markup_, a _Bad Option_ error is emitted |
| 74 | +and the value of the `u:dir` option is ignored. |
| 75 | + |
| 76 | +During processing, the `u:dir` option |
| 77 | +MUST be removed from the resolved mapping of _options_ |
| 78 | +before calling the _function handler_. |
| 79 | + |
| 80 | +The value of the `u:dir` _option_ MUST be one of the following _literal_ values |
| 81 | +or a _variable_ whose _resolved value_ is one of these _literals_: |
| 82 | +- `ltr`: left-to-right directionality |
| 83 | +- `rtl`: right-to-left directionality |
| 84 | +- `auto`: directionality determined from _expression_ contents |
| 85 | + |
| 86 | +For other values, a _Bad Option_ error is emitted |
| 87 | +and the value of the `u:dir` option is ignored. |
0 commit comments