From 89e43f05ff4f38b9d334a844b71fccbb7efac6af Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Sun, 18 Feb 2024 11:13:43 -0800 Subject: [PATCH 1/2] Address #619: add a note about `*` variant Per my action-item, add an appropriate note about the requirement for the fallback variant, including text seeking feedback in tech preview. --- spec/formatting.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/formatting.md b/spec/formatting.md index 6c9587b26b..192b4a65fe 100644 --- a/spec/formatting.md +++ b/spec/formatting.md @@ -372,6 +372,18 @@ to provide the _pattern_ for the formatting operation. This is done by ordering and filtering the available _variant_ statements according to their _key_ values and selecting the first one. +> [!NOTE] +> At least one _variant_ is required to have all of its _keys_ consist of +> the fallback value `*`. +> Some _selectors_ might be implemented in a way that this _variant_ +> cannot be selected in a _valid_ _message_. +> In other cases, this _variant_ might be unreachable only in certain locales. +> +> In the Tech Preview, feedback from users and implementers is desired about +> whether to relax the requirement that such a "fallback _variant_" appear in +> every message, versus the potential for a _message_ to fail at runtime +> because no matching _variant_ is available. + The number of _keys_ in each _variant_ MUST equal the number of _selectors_. Each _key_ corresponds to a _selector_ by its position in the _variant_. From 6b7edd4d4d124f0913e23b9a41059a5a8c0af7c8 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 19 Feb 2024 07:46:38 -0800 Subject: [PATCH 2/2] Address @stasm's comment --- spec/formatting.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/spec/formatting.md b/spec/formatting.md index 192b4a65fe..17b2abfd79 100644 --- a/spec/formatting.md +++ b/spec/formatting.md @@ -375,9 +375,21 @@ according to their _key_ values and selecting the first one. > [!NOTE] > At least one _variant_ is required to have all of its _keys_ consist of > the fallback value `*`. -> Some _selectors_ might be implemented in a way that this _variant_ +> Some _selectors_ might be implemented in a way that the key value `*` > cannot be selected in a _valid_ _message_. -> In other cases, this _variant_ might be unreachable only in certain locales. +> In other cases, this key value might be unreachable only in certain locales. +> This could result in the need in some locales to create +> one or more _variants_ that do not make sense grammatically for that language. +> > For example, in the `pl` (Polish) locale, this _message_ cannot reach +> > the `*` _variant_: +> > ``` +> > .match {$num :integer} +> > 0 {{ }} +> > one {{ }} +> > few {{ }} +> > many {{ }} +> > * {{Only used by fractions in Polish.}} +> > ``` > > In the Tech Preview, feedback from users and implementers is desired about > whether to relax the requirement that such a "fallback _variant_" appear in