Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(Design) Number Selection #471
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
(Design) Number Selection #471
Changes from all commits
13dcd0f
d9bffce
e5c173a
3cc961f
702b1e2
e541343
08b5160
431558d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Sorry, but it is not that obvious.
:number
is not a question, so one can't decide on it.You have to ask a question about the number.
"Hey,
:number 43
?"Is that true or false? If you answer correctly you win 1000$"
That means nothing. It is not a good question.
Hey, :number 43 is even?
" is a question, you can answer.Hey, :number 43 is prime?
" is a question, you can answer.Hey, :number 43 is plural?
" is a question, you can answer.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.
There are two questions here.
The first is: should the
:number
function used for formatting also do selection? @eemeli has already pointed out that we want users to use the same configuration for selection (e.g. with:plural
) as will ultimately be used to format the number. This message produces grammatically inferior results:The second question is: if
:number
is a selector, what sort of selector is it by default? @eemeli answers that:plural
is the most common usage. Alternatives would be:ordinal
and whatever we call exact match. I agree with @eemeli that:plural
is the far-and-away most common case and thus should be the default.So... @mihnita are you objecting to the phrasing here or the conclusion? If the phrasing, do you want to suggest alternate text?
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.
@aphillips Your "won't be seen" comment is a bit misleading, as the problem with that message is that the
one
variant may indeed be seen, formatted as "You have 1.0 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.
You're right.. that comment goes against what I'm trying to say, so I fixed it.
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.
Since we already defined
$tenths
and use it in the body of the options, then I expect:plural
on it:And not doing that is easy to do at lint time.
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.
Is this list exhaustive? #532 includes
:integer
. Presumably:integer
is an integer plural selector by default (in addition to being a formatter).Other candidates for shorthands might be
:percent
,:currency
and (maybe??):scientific
. The first two are shorthands in ICU4J MF1.scientific
is a numeric formatting option (but not exposed by MF1).There is also the potentially lamentable
:spellout
from ICU4J MF1.I'm guessing that what we want to promote is single-annotation messages, e.g.:
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 think the ones you mention are all formatters? The list here is purely about
.match
selectors, and for that I think just:plural
and:ordinal
could be enough. If you need exact matching, then the relatively rare:number select=exact
is pretty good?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.
To clarify a bit, a proposed alias like
:integer
or:spellout
still ends up calling the:number
function, and so if the expression doesn't have an explicitselect
attribute and the alias does not setsupports="format"
, it'll end up inheriting the defaultselect="plural"
for selection, together with the rest of the expression & alias options.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.
They are, but your assertion is that formatters and selectors are the same thing. There's some convenience to configuring the formatter and then using it as the selector also. None of the ones I mention would use
exact
orordinal
as the default selector.We could just require that users use
type=XXX
for formatting options. That would make the example I gave:Maybe more interesting examples would be:
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.
Here's how I would classify the different aliases that have been mentioned so far:
:integer
-- The most obvious one, and therefore included already in #532.:plural
and:ordinal
-- Functions for selection only withsupports="match"
. Included in this design doc.:percent
,:currency
,:scientific
,:spellout
-- Possible aliases for later/separate consideration. As with:integer
, they might be used also for selection, but I don't see how any of them would specify a<setOption name="select">
. So I don't think they belong in a design doc on Number Selection.Once #532 lands, would a PR adding that third set be the right focal point for discussion of their merits, rather than this PR?
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.
:ordinal
is a formatter tooThere 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 agree that
:ordinal
could also be a formatter, but I am not here proposing that it be one of the core formatters that we expect all MF2 implementations to provide. That could be considered as a separate further step, should this design on number selection first introduce it as a selector.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 need to? Can we finish up numbers and be done with them? 😁
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 would very strongly prefer taking this smaller step first, and not expanding the scope of this design document.
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 noted elsewhere,
:ordinal
is also a formatter or formatting option, at least in MF1. The name for the selector (selectordinal
) and the formatter (ordinal
) are different because MF1's parser needed separate keywords (the syntax doesn't separate selectors and formatters the way ours does), but we don't have that problem.