diff --git a/spec/registry.dtd b/spec/registry.dtd index 312bd4008..706c651d0 100644 --- a/spec/registry.dtd +++ b/spec/registry.dtd @@ -18,7 +18,7 @@ position (open|close|standalone) "standalone" > - + + + + + + + diff --git a/spec/registry.md b/spec/registry.md index e191b052f..678ba6a6a 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -66,8 +66,33 @@ the corresponding input and options rules. If multiple `` elements would match the current locale, only the first one is used. -Matching-function signatures additionally include one or more `` elements -to define the keys against which they can match when used as selectors. +### Variant Key Matches + +Selector signatures can include `` and `` elements +defining the variant keys matched by the selector. + +Each `` contains either a (possibly empty) set of `` elements or an `href` attribute. +If `` contains both an `href` attribute and child elements +the `href` attribute is ignored. +If `` contains only an `href` attribute, any `validationRule` attributes are ignored. +The `href` attribute MUST resolve to an XML document whose root element is ``. +The contents of the resolved XML document replaces the current `matches` element for all later processing. + +The `` element whose `locales` best matches the current locale +using resource item [lookup](https://unicode.org/reports/tr35/#Lookup) from LDML is used. +An element with no `locales` attribute is the default +(and is considered equivalent to the `root` locale). + +In situations where the available keys depend on option values, +`` elements can be used to select an appropriate `` element for selection. +If the resolved or default value of a selector option +corresponding to the `` `option` attribute +is included in its list of `values`, +its contents are considered before any and all later `` and `` elements. +If a `` element within a matching `` has a `` for the current locale, +later `` outside that `` are not considered. + +### Function Aliases Functions may also include `` definitions, which provide shorthands for commonly used option baskets. @@ -104,15 +129,25 @@ For the sake of brevity, only `locales="en"` is considered. - @@ -144,18 +179,18 @@ Given the above description, the `:number` function is defined to work both in a ``` Furthermore, -`:number`'s `` contains two `` elements +`:number`'s `` contains multiple `` and `` elements which allow the validation of variant keys. -The element whose `locales` best matches the current locale -using resource item [lookup](https://unicode.org/reports/tr35/#Lookup) from LDML is used. -An element with no `locales` attribute is the default -(and is considered equivalent to the `root` locale). -- `` can be used in locales like `en` and `en-GB` - to validate the `when other` variant by verifying that the `other` key is present - in the list of enumarated values: `one other`. -- `` can be used to valide the `when 1` variant - by testing the `1` key against the `anyNumber` regular expression defined in the registry file. +- `` + can be used in locales like `en` and `en-GB` if the selection type is known to be plural + to validate that only `one`, `other` or numeric keys are used for variants. +- `` + can be used in locales like `en` and `en-GB` if the selection type is known to be ordinal + to validate that only `one`, `two`, `few`, `other` or numeric keys are used for variants. +- `` can be used + for all locales and selection types, validating that variant keys are either numeric + or use one of the plural category identifiers. ---