edrlab / thorium-reader

A cross platform desktop reading app, based on the Readium Desktop toolkit
https://www.edrlab.org/software/thorium-reader/
BSD 3-Clause "New" or "Revised" License
1.86k stars 157 forks source link

i18n: Add support for plural forms #2660

Open naglis opened 1 week ago

naglis commented 1 week ago

i18next, the library used by Thorium for translations, supports plurals, but it is currently not used in Thorium.

I think it would be nice to display the correctly pluralized strings instead of appending all the possible variations at the end (e.g. 42 match(es)).

IIUC, there are a few strings that would benefit from plurals in Thorium:

I have experimented with adding support for it (i18next JSON v3, v4), it seems to work nicely. Please note that in order for i18next to apply plurals, the number placeholder must be named count.

There are some issues/unanswered questions: