Earlier quoted context omitted.
I checked the spec and don't get that really. Something should specify the formula for choosing the correct form (ie 1 for 21 in Slavic languages) and the format isnt any better compared to the gettext of 30 years ago
This confused me too but the formula and rules for variants are specified by the configured language out-of-band, so there is support for this. Let's take your example. In English, counting files looks like this: You have {file_count, plural, =0 {no files} one {1 file} other {# files} } In Polish, there are several possible variants depending on the count: Masz 1 plik Masz 2,3,4 pliki Masz 5-21 pliko'w Masz 22-24 pli…
MessageFormat: Unicode standard for localizable message strings
31–40 of 68 posts
Re: MessageFormat: Unicode standard for localizable message strings
#32One practical thing I appreciated about MessageFormat is how it eliminates a bunch of conditional UI logic. I used to write switch/if blocks for: • 0 rows → “No results” • 1 row → “1 result” • n rows → “{n} results” Which seems trivial in English, but gets messy once you support languages with multiple plural categories. I wasn’t really aware of how nuanced plural rules are until I dug into ICU. The syntax looked int…
Did not gettext have this for decades? https://www.gnu.org/software/gettext/manual/html_node/Plural...
Re: MessageFormat: Unicode standard for localizable message strings
#33Re: MessageFormat: Unicode standard for localizable message strings
#34Looks alot like mozilla's project fluent, atleast in the basic use case. https://projectfluent.org/ I wonder why it hasn't been adopted more widely.
Here's a comparison between the two on Fluent's wiki: https://github.com/projectfluent/fluent/wiki/Fluent-and-ICU-... It seems the last edit of the page was in 2019, so I'm not sure how up to date it is.
Re: MessageFormat: Unicode standard for localizable message strings
#35One practical thing I appreciated about MessageFormat is how it eliminates a bunch of conditional UI logic. I used to write switch/if blocks for: • 0 rows → “No results” • 1 row → “1 result” • n rows → “{n} results” Which seems trivial in English, but gets messy once you support languages with multiple plural categories. I wasn’t really aware of how nuanced plural rules are until I dug into ICU. The syntax looked int…
Seems like to get it right for every use case / language, you would need functions to translate phrases - so switch statements may be a valid solution. The number of text elements needed for pagination, CRUD operations and similiar UI elements should be finite :)
Re: MessageFormat: Unicode standard for localizable message strings
#36Does anyone know the ETA of MessageFormat 2.0? I am aware of the effort since pre-COVID times. I recall that some of the developers behind Mozilla Fluent have been among the people working on MF 2.0, and it’d be great to know whether Fluent and ICU MF are going to be interoperable in foreseeable future.
Re: MessageFormat: Unicode standard for localizable message strings
#37Re: MessageFormat: Unicode standard for localizable message strings
#38Earlier quoted context omitted.
This post shows a lot of the challenges with localisation, that many seemingly simple tools don't have an answer to: https://hacks.mozilla.org/2019/04/fluent-1-0-a-localization-... (Fluent informed much of the design of MessageFormat 2.)
Indeed, if only it were as simple as “{n} rows”. I18n / l10n is full of things like this, important details that couldn’t be more boring or fiddly to implement.
Re: MessageFormat: Unicode standard for localizable message strings
#39One practical thing I appreciated about MessageFormat is how it eliminates a bunch of conditional UI logic. I used to write switch/if blocks for: • 0 rows → “No results” • 1 row → “1 result” • n rows → “{n} results” Which seems trivial in English, but gets messy once you support languages with multiple plural categories. I wasn’t really aware of how nuanced plural rules are until I dug into ICU. The syntax looked int…
Re: MessageFormat: Unicode standard for localizable message strings
#40Earlier quoted context omitted.
Indeed, if only it were as simple as “{n} rows”. I18n / l10n is full of things like this, important details that couldn’t be more boring or fiddly to implement.
Which is why Windows UI is littered with language like "number of rows: {n}".