Skip to content

Consider dropping selection for :currency and :unit #987

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

Closed
eemeli opened this issue Jan 21, 2025 · 2 comments
Closed

Consider dropping selection for :currency and :unit #987

eemeli opened this issue Jan 21, 2025 · 2 comments
Labels
functions Issue pertains to the default function set LDML47 LDML 47 Release (Stable)

Comments

@eemeli
Copy link
Collaborator

eemeli commented Jan 21, 2025

A thought arising from implementing a fix for #956: selection on currency, percent, and unit values is likely to be exceedingly rare, and to be potentially confusing especially for exact matches. For example, for the following message, consider which variant would an implementation match, and which variant would a user presume to match?

.local $pct = {0.5 :percent}
.match $pct
0.5   {{Is {$pct} matched as a fraction?}}
50    {{Is {$pct} matched as a whole number?}}
|50%| {{Is {$pct} matched as the formatted value?}}
*     {{Or is {$pct} matched as something else?}}

My contention here is that this is confusing, and we should avoid the issue by not allowing selection on :currency, :percent, or :unit. Note that this doesn't prevent an author from writing such messages, they just need to use an explicit :number:

.input {$dist :number}
.local $miles = {$dist :unit unit=mile}
.match $dist
0 {{You are at your destination}}
* {{You are {$miles} from your destination}}
@eemeli eemeli added the functions Issue pertains to the default function set label Jan 21, 2025
@aphillips
Copy link
Member

We've had this argument before. Selection on currency is extremely common. Unit is less common because of the inflective bits in the CLDR/ICU implementation (although these are incomplete for forming sentences, eh?). Percent is probably not that rare. I've seen messages like "You have a 10% credit" or "You have 12% off today only", which need selection to get it right.

@aphillips aphillips added the LDML47 LDML 47 Release (Stable) label Jan 31, 2025
@eemeli
Copy link
Collaborator Author

eemeli commented Feb 5, 2025

This was closed by #991.

@eemeli eemeli closed this as completed Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions Issue pertains to the default function set LDML47 LDML 47 Release (Stable)
Projects
None yet
Development

No branches or pull requests

2 participants