Collect all possible MessageFormat use cases
The goal is to collect real/possible examples for message format. That way we can create a dataset of formats and use cases that will allow us to evaluate and understand the real needs of the users.
- "Cases that are extreme or hard to implement are the ones we wan't to see :) "
- "Bad i18n practices"
Please add below all the use cases you can find
** This issue is duplication of #2 **
I dare anyone to translate this example to Arabic, using external selectors only:
This all-inclusive resort includes {poolCount, plural, =0 {no pools} one {# pool} other {# pools}}, {restaurantCount, plural, =0 {no restaurants} one {# restaurant} other {# restaurants}}, {beachCount, plural, =0 {no beaches} one {# beach} other {# beaches}} and {golfCount, plural, =0 {no golf courses} one {# golf course} other {# golf courses}}.
I posted my degenerate-case message example in this comment on #103.
Here's an example from Mozilla's Common Voice website, in Fluent syntax. The message uses from independent plurals:
activity-needed-calculation-plural = { NUMBER($totalHours) ->
[one] {$totalHours} hour
*[other] {$totalHours} hours
} is achievable in just over { NUMBER($periodMonths) ->
[one] {$periodMonths} month
*[other] {$periodMonths} months
} if { NUMBER($people) ->
[one] {$people} person
*[other] {$people} people
} record { NUMBER($clipsPerDay) ->
[one] {$clipsPerDay} clip
*[other] {$clipsPerDay} clips
} a day.
@Comment 2
mainMessage = This all-inclusive resort includes {listOfFeatures}.
featurePools = {poolCount, plural, =0 {no pools} one {# pool} other {# pools}}
featureRestaurants = {restaurantCount, plural, =0 {no restaurants} one {# restaurant} other {# restaurants}}
featureBeaches = {beachCount, plural, =0 {no beaches} one {# beach} other {# beaches}}
featureGolf = {golfCount, plural, =0 {no golf courses} one {# golf course} other {# golf courses}}
...
// And use a ListFormatter
This allows even nicer final result by allowing the exclusion of the =0 cases, because (maybe) we don't want to say
"This all-inclusive resort includes no pools, 1 restaurant, no beaches, and no golf course."
You only add to the list the features that have a count > 0.
So the final result would be something like this (the "all plural" case)
70 hours is achievable in just over 2 months if 2 people record 3 clips a day.
This is how I would "attack" it:
{ [plural(peopleCount), plural (clipCount)]
[ one one] {hoursDuration} is achievable in just over {monthsDuration} if {$people} person {$clipsPerDay} clip a day.}
[other one] {hoursDuration} is achievable in just over {monthsDuration} if {$people} people {$clipsPerDay} clip a day.}
[ one other] {hoursDuration} is achievable in just over {monthsDuration} if {$people} person {$clipsPerDay} clips a day.}
[other other] {hoursDuration} is achievable in just over {monthsDuration} if {$people} people {$clipsPerDay} clips a day.}
}
We have duration formatters in ICU. If a platform does not have them, the MF2 will accept custom functions (we all agree?), and one can add them.
"Support custom / pluggable "formatters" (beside Date/Time/Number ...)" https://github.com/unicode-org/message-format-wg/issues/22
"Have pluggable “formatters”(Date/Time/Number ...)" https://github.com/unicode-org/message-format-wg/issues/3
"IMHO the future MF API should be focused on providing a low-level set of APIs extending the built-in Intl with reusable and pluggable formatters etc..." https://github.com/unicode-org/message-format-wg/issues/2
This issue appears to be duplicated by other issues and is not being used to track all use cases. The discussion of examples above is a good one, but is now stale. If you are considering reopening this issue, please think about opening a new issue or issues with specific change requests.