-
-
Notifications
You must be signed in to change notification settings - Fork 35
Address #619: add a note about * variant
#666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
spec/formatting.md
Outdated
| > 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the note about locales is relevant here? How about:
| > In other cases, this _variant_ might be unreachable only in certain locales. | |
| > In other cases, this _variant_ may be interpreted as a valid catch-all variant, rather than a fallback in case of failed selection. |
| > > 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.}} | ||
| > > ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be a simpler example for what's being demostrated here?
| > > 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.}} | |
| > > ``` | |
| > > For example, in the `en` (English) locale, this _message_ cannot reach | |
| > > the `*` _variant_ unless `$num` is not a valid number: | |
| > > ``` | |
| > > .match {$num :number} | |
| > > one {{ }} | |
| > > other {{ }} | |
| > > * {{ }} | |
| > > ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to promote the use of other with the number functions? In English? I thought the Polish example was clever because it naturally exposes the issue at hand (and begs the question "what does that message say?"). But happy to accept this too...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I've understood, in Polish many is the fallback category, so explicitly including it (as in your example) is not really any different from my proposal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
many is the fallback for integers (I used the function :integer on purpose), but IIUC other is used for fractions. Maybe my example was too subtle... (see here in the charts)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, wrote one comment but it's not blocking
| > [!NOTE] | ||
| > At least one _variant_ is required to have all of its _keys_ consist of | ||
| > the fallback value `*`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence is a little awkward, but I can't think of a good way to rephrase it.
Unless you do something like:
"An exhaustive variant is required. In an exhaustive variant, every key must be the fallback value *."
Not a big deal, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. The phrasing is a bit chewy. I didn't want to create a new term like "exhaustive variant" just for the note.
| > Some _selectors_ might be implemented in a way that the key value `*` | ||
| > cannot be selected in a _valid_ _message_. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we give an example of such a selector?
| > Some _selectors_ might be implemented in a way that the key value `*` | |
| > cannot be selected in a _valid_ _message_. | |
| > Some _selectors_ might be implemented in a way that the key value `*` | |
| > cannot be selected in a _valid_ _message_. | |
| > | |
| > ``` | |
| > .match {$result :boolean} | |
| > true {{Result is true}} | |
| > false {{Result is false}} | |
| > * {{Unreachable}} | |
| > ``` |
I think this would make it easier to understand why the next sentence starts with "in other cases... only in certain locales".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to avoid using functions that don't exist 😉
.match {$boolean :string}
true {{Result is true}}
false {{Result is false}}
* {{Unreachable?}}
|
I'm going to merge this and we can mess with it more later. It's a non-normative note and we need to focus on the normative stuff. |
Per my action-item, add an appropriate note about the requirement for the fallback variant, including text seeking feedback in tech preview.
Fixes #619