unsplash / intlc

Compile ICU messages into code. Supports TypeScript and JSX. No runtime.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Up-pluralising

samhh opened this issue · comments

No idea what to call this! It will enable us to support languages with more plural forms in a tool that doesn't support ICU syntax. Translators can't change the plural forms themselves in such a tool, but they can duplicate messages across unneeded plural forms.

We'd replace any instances of {x, plural, one {y} other {z}} in an English translation with {x, plural, zero {z} one {y} two {z} many {z} other {z}}. It's unclear exactly which plural forms to include.

Ideally we could run this during zipping to avoid having to change our actual master translations.

This will imply worse bundling performance however there aren't that many plurals in use, so it shouldn't matter. In theory if this is ever a problem we could add optimisation to the compiler to combine any switch branches with equivalent content.