|
|
|
|
|
by drewfish
4260 days ago
|
|
Yeah, for a simple plural that can be a bit longer. In other languages, though, the pluralization rules get rather complicated[1]. (For example, Arabic has both complicated pluralization rules -and- a lot of people who speak it.) The strength of the ICU message format, in my mind, is that the messages can be "nested" so that the translation can be customized for multiple concerns (plural, gender, whatever). Also, with the integrations (dust, handlebars, react) the details of translation and display of data lives in the message format and/or template. This is the "view layer", and means that your controller/code isn't littered with a bunch of calls to a translation library. [1] http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/la... |
|
Though i18n-js does let you write your own pluralizations rules (taken from the readme), while supporting zero/one/many out of the box:
I've posted an example below, but I don't consider `@div null, @t('welcomeMessage', { username })` "littering" my code.