-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i18n: Add support for plural forms #2660
Comments
Note that since See:
The tooling didn't reveal any change in Thorium's existing JSON locales:
Related commit: 4a80487#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519 |
@danielweck, would you be open to a PR that would change the places in the code where strings with possible plurals are used to use the IIUC care would needed (if |
the "count" renaming seems safe for GitLocalize as long as no translation is in-progress (limbo state between an accepted merged pull request and a clean original translation synchronized with GitHub) |
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:
reader.picker.search.founds
dialog.annotations.descList
dialog.annotations.descNewer
dialog.annotations.descOlder
dialog.deleteAnnotationsText
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:
i18next-json-sync
(the CLI tool to extract translatable strings) does not support plural keys (it simply removes them), although there are alternatives, e.g. https://github.com/felixmosh/i18next-locales-sync.en
keys would be:foo_one
andfoo_other
, thelt
(Lithuanian) keys would befoo_one
,foo_few
,foo_other
. How would GitLocalize handle thefoo_few
key (what would it display as the "source" value?) when translatingen
->lt
?The text was updated successfully, but these errors were encountered: