Skip to content
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: enable i18next plurals #2743

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

naglis
Copy link
Contributor

@naglis naglis commented Jan 1, 2025

Addresses: #2660

Use the count placeholder name for strings which might have different translations depending on the number of results, which enables nicer messages, e.g. "1 match" instead of "1 match(es)".

count is the reserved placeholder for plural forms used in i18next.

Translations can use different suffixes to provide the right messages for all the plural forms applicable to that language. To find out which suffixes should be used for a particular language, this JSFiddle can be used.

NOTE: GitLocalize most likely will not support the extra plural forms in different languages, so in order to add/modify them, the translator will have to make PRs. Also, i18next-json-sync (the CLI tool to extract translatable strings) does not support plural keys (it simply removes them). See #2660 for more information.

@naglis naglis force-pushed the enable-i18next-plurals branch 2 times, most recently from 9d9995a to 5a794a0 Compare January 9, 2025 16:39
@naglis naglis force-pushed the enable-i18next-plurals branch 3 times, most recently from 6168b92 to 3f54390 Compare January 31, 2025 16:35
@danielweck danielweck marked this pull request as draft January 31, 2025 18:56
@naglis naglis force-pushed the enable-i18next-plurals branch 2 times, most recently from ccb79f6 to 365c7cb Compare February 2, 2025 08:05
Use the `count` placeholder name for strings which might have different
translations depending on the number of results, which enables nicer
messages, e.g. "1 match" instead of "1 match(es)".

`count` is the reserved placeholder for plural forms used in i18next[1].

Translations can use different suffixes to provide the right messages for
all the plural forms applicable to that language. To find out which
suffixes should be used for a particular language, this JSFiddle[2] can
be used.

[1]: https://www.i18next.com/translation-function/plurals
[2]: https://jsfiddle.net/6bpxsgd4
@naglis naglis force-pushed the enable-i18next-plurals branch from 365c7cb to 01bdfe8 Compare February 2, 2025 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant