From cbc74dacc859a318de732d65d96fa3df59877caa Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Sat, 9 Dec 2023 11:40:26 +0200 Subject: [PATCH 1/7] Make Lookup reference more clearly normative by moving it out of the example --- spec/registry.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/registry.md b/spec/registry.md index e191b052f..572d63561 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -68,6 +68,10 @@ 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. +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). Functions may also include `` definitions, which provide shorthands for commonly used option baskets. @@ -146,10 +150,6 @@ Given the above description, the `:number` function is defined to work both in a Furthermore, `:number`'s `` contains two `` 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 From de75c134e3e2d42effd3a1be539542df94548c1a Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Sat, 9 Dec 2023 12:05:12 +0200 Subject: [PATCH 2/7] Add to help select the right --- spec/registry.dtd | 8 +++++++- spec/registry.md | 35 ++++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/spec/registry.dtd b/spec/registry.dtd index 312bd4008..3f9a1a336 100644 --- a/spec/registry.dtd +++ b/spec/registry.dtd @@ -18,7 +18,7 @@ position (open|close|standalone) "standalone" > - + + + + ` elements can be used to select an appropriate set of `` elements 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 `` matches the current locale, +later `` elements outside that `` are not considered. + Functions may also include `` definitions, which provide shorthands for commonly used option baskets. An _alias name_ may be used equivalently to a _function name_ in messages. @@ -108,14 +117,18 @@ For the sake of brevity, only `locales="en"` is considered. - @@ -148,14 +161,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. -- `` 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. --- From bacc04c4db5b61b1725508febb34e432f1cda461 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 11 Dec 2023 14:34:52 +0200 Subject: [PATCH 3/7] Add , with href --- spec/registry.dtd | 11 ++++++++--- spec/registry.md | 44 +++++++++++++++++++++++++++++++------------- 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/spec/registry.dtd b/spec/registry.dtd index 3f9a1a336..706c651d0 100644 --- a/spec/registry.dtd +++ b/spec/registry.dtd @@ -18,7 +18,7 @@ position (open|close|standalone) "standalone" > - + + + + - + ` 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 + +Matching-function signatures can include `` and `` elements +defining the variant keys matched by the selector. + +Each `` MAY contain either one or more `` elements, or an `href` attribute. +If an `href` attribute is set, its URL value MUST resolve to an XML document +with a root `` element with no `href` attribute, +which will then replace the current `` element for all later processing. +If `` contains any child elements, its `href` attribute is ignored. +Otherwise, if `` contains an `href` attribute, its `validationRule` attribute is ignored. + 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). As the available keys may depend on option values, -`` elements can be used to select an appropriate set of `` elements for selection. +`` 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 `` matches the current locale, -later `` elements outside that `` are not considered. +its contents are considered before any and all later `` and `` elements. +If a `` element within a `` has a `` for the current locale, +later `` elements outside that `` are not considered. + +### Function Aliases Functions may also include `` definitions, which provide shorthands for commonly used option baskets. @@ -124,12 +136,18 @@ For the sake of brevity, only `locales="en"` is considered. @@ -161,16 +179,16 @@ Given the above description, the `:number` function is defined to work both in a ``` Furthermore, -`:number`'s `` contains multiple `` and `` elements +`:number`'s `` contains multiple `` and `` elements which allow the validation of variant keys. -- `` +- `` 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 +- `` can be used for all locales and selection types, validating that variant keys are either numeric or use one of the plural category identifiers. From d2ca815c5b8596cabd46c4ee23ff0d7f5ca25265 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 11 Dec 2023 23:18:48 +0200 Subject: [PATCH 4/7] Apply suggestions from code review Co-authored-by: Addison Phillips --- spec/registry.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/registry.md b/spec/registry.md index c0ee79814..96e92ac0a 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -72,18 +72,18 @@ Matching-function signatures can include `` and `` elements defining the variant keys matched by the selector. Each `` MAY contain either one or more `` elements, or an `href` attribute. -If an `href` attribute is set, its URL value MUST resolve to an XML document -with a root `` element with no `href` attribute, -which will then replace the current `` element for all later processing. -If `` contains any child elements, its `href` attribute is ignored. -Otherwise, if `` contains an `href` attribute, its `validationRule` attribute is ignored. +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). -As the available keys may depend on option values, +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 From 3e9e314aa0d5f6421b3d84b8512f4f569b6fb4a2 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Tue, 12 Dec 2023 00:33:23 +0200 Subject: [PATCH 5/7] Update spec/registry.md Co-authored-by: Addison Phillips --- spec/registry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/registry.md b/spec/registry.md index 96e92ac0a..e5bb9a092 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -71,7 +71,7 @@ only the first one is used. Matching-function signatures can include `` and `` elements defining the variant keys matched by the selector. -Each `` MAY contain either one or more `` elements, or an `href` attribute. +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. From 56d3362dc6810b021b7c3d67ac5a05ba33ce116e Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Tue, 12 Dec 2023 17:43:30 +0200 Subject: [PATCH 6/7] Update spec/registry.md Co-authored-by: Addison Phillips --- spec/registry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/registry.md b/spec/registry.md index e5bb9a092..c5b0a7da5 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -68,7 +68,7 @@ only the first one is used. ### Variant Key Matches -Matching-function signatures can include `` and `` elements +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. From 566b9160e113ae905d5cf058acd25ef4c013b279 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Sat, 16 Dec 2023 09:18:35 +0200 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: Addison Phillips --- spec/registry.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/registry.md b/spec/registry.md index c5b0a7da5..678ba6a6a 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -89,8 +89,8 @@ 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 `` has a `` for the current locale, -later `` elements outside that `` are not considered. +If a `` element within a matching `` has a `` for the current locale, +later `` outside that `` are not considered. ### Function Aliases