Looks alot like mozilla's project fluent, atleast in the basic use case.
I wonder why it hasn't been adopted more widely.
The meeting notes in the repo was a nice surprise. Overall looked great, striking a good balance.
.input {$var :number maximumFractionDigits=0}
.local $var2 = {$var :number maximumFractionDigits=2}
.match $var2
0 {{The selector can apply a different function to {$var} for the purposes of selection}}
* {{A placeholder in a pattern can apply a different function to {$var :number maximumFractionDigits=3}}}
Oof, that's a programming language already. And new syntax to be inevitably iterated on. I feel like we have too many of those already, from Python f-strings to template engines.I wish it'll at least stay small: no nesting, no plugins, no looping, no operators, no side effects or calls to external functions (see Log4J).
Does 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.
My project Lokalized attempts to solve many of these complex plural/gender/ordinal/etc. rules with a tiny expression language:
I know these libs are primarily for devs to localize their apps but can they be used also with untrusted inputs, both message strings and vars?
This seems great in concept, and totally infeasible. But if anyone can do it, unicode seems like a great candidate.
Does anyone have reason for more optimism?
I discovered it working in https://tolgee.io but I am kind of surprised it boomed today :D
What I can say that it's a well-maintained format but also kinda hard to learn.
Looking for an expert who knows both libintl/Gettext and MessageFormat.
What is the equivalent of xgettext.pl, the file extension for the main catalog file `.po`, the __ function?
How does gender work (small example)? How does layering pt_BR on pt_PT work?
What is a compelling reason to switch?
Apologies if this is obvious and I missed it. Does this define a way to store the strings in various languages?
One 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 intimidating at first, but it actually removes a lot of branching from application code.
I’ve been using an online ICU message editor (https://intlpull.com/tools/icu-message-editor) to experiment with plural/select cases and different locales helped me understand edge cases much faster than reading the spec alone.