Skip to content
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

Review non-integral exact number selection algorithm #675

Open
eemeli opened this issue Feb 21, 2024 · 3 comments
Open

Review non-integral exact number selection algorithm #675

eemeli opened this issue Feb 21, 2024 · 3 comments
Labels
blocker-candidate The submitter thinks this might be a block for the Technology Preview LDML 47 LDML 47 Release (Stable) registry Seek-Feedback-in-Preview Issue should be something we seek feedback on in the tech preview period

Comments

@eemeli
Copy link
Collaborator

eemeli commented Feb 21, 2024

After the discussions in #621 (comment) and #621 (comment) as well as our live calls, we ended up leaving out an explicit definition of numerical matching for non-integer values like 0.0 or 1.5, but the text around this carries three separate notes about the current solution.

After the publication of LDML 45, we should revisit this and seek to specify the text further. We should also ensure that our solution is in line with the existing LDML Language Plural Rules, which includes a section on Explicit 0 and 1 rules. In particular, there we already have:

The explicit “0” and “1” cases apply to the exact numeric values 0 and 1 respectively. These cases are typically used for plurals of items that do not have fractional value, like books or files.

This should be accounted for in the MF2 text, and an appropriate solution here might be to expand the current Language Plural Rules section, so that in the MF2 text we can refer to it for exact number matching.

@eemeli eemeli added formatting Seek-Feedback-in-Preview Issue should be something we seek feedback on in the tech preview period labels Feb 21, 2024
@macchiati
Copy link
Member

macchiati commented Feb 21, 2024 via email

@aphillips
Copy link
Member

I agree with having this issue. I note (as I did in the call) that exact fraction matching is a rare corner case. Plural rules work just fine with non-integer values to produce keywords (fractions, including ones like 1.0, often produce a different plural rule than integers).

I do not agree that this is plural matching. The explicit 0 and 1 cases in the quoted text are not "plural cases". The value 1 or the value 0 produce named rules to form grammatically correct strings just like any other. (In English, 0 produces other and 1 produces one) What is special about 0 and sometimes 1 is that the message needs to say something different for specifically that value. That's why I have pushed back on examples like these:

.match {$numChances :integer}
0 {{You are out of chances}}
1 {{This is your last chance}} <- works, but tools need to generate `one` for many languages
* {{You have {$numChances} chances remaining}}

.match {$numChances :integer}
0 {{You are out of chances}}
one {{This is your last chance}} <- wrong. never shows in ja, shows for values like 21 in pl
* {{You have {$numChances} chances remaining}}

in favor of:

.match {$numChances :integer}
0 {{You are out of chances}}
1 {{This is your last chance}}
one {{You have {$numChances} chance remaining}}
* {{You have {$numChances} chances remaining}}

Which brings us back to fractional matching. I can imagine cases for it:

.match {$distanceRemaining}
1.5 {{You have exactly {1.5 :number} wildebeest}}

But the more common use case is to have cutoff points, like switching units or from compact to full presentation. (This is the one thing ChoiceFormat is good at):

.match {$distanceRemaining :choice}
0 {{You have arrived}}
<0.5 {{You have {$distanceRemaining :measure unit=meter} remaining}}
<10.0 {{You have {$distanceRemaining :measure unit=kilometer display=long} remaining}}
* {{You have {$distanceRemaining :measure unit=kilometer display=compact} remaining}}

catamorphism added a commit to catamorphism/message-format-wg that referenced this issue Mar 9, 2024
These tests may be able to be re-added after resolving
unicode-org#675
aphillips pushed a commit that referenced this issue Mar 9, 2024
These tests may be able to be re-added after resolving
#675
@mihnita mihnita added the blocker-candidate The submitter thinks this might be a block for the Technology Preview label Aug 28, 2024
@aphillips
Copy link
Member

Moving this to registry, since the number functions are where this is defined. The WG consensus in 46.1 is that we're fine with integer selection being well-defined with implementations allowed to support non-integer selection. We don't want to close this issue, but we aren't going to fix it in 46.1.

@aphillips aphillips added the LDML 47 LDML 47 Release (Stable) label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker-candidate The submitter thinks this might be a block for the Technology Preview LDML 47 LDML 47 Release (Stable) registry Seek-Feedback-in-Preview Issue should be something we seek feedback on in the tech preview period
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants