You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new API for specifying plurals in code, with explicit default messages for all plural forms.
Motivation
Many people's i18n workflow is to write default phrases in UI code with explicit keys with t() / <Trans />, and then extract them with i18next-parser.
Plurals make this very awkward because there's no way to extract additional plural forms from source code, so you must write one form in code, run i18n-parser, then go edit the json messages file with the additional forms. It also means there's no single source of truth for phrases, as additional plural forms would only live in the json messages file.
Example
t.plural("inbox.new-messages",{other: "You have {count} new messages",one: "You have {count} new message"},{ count })
I can't really see a great API for supporting this with the React <Trans />.
If accepted, I'm happy to work on this and contribute it to i18next, and the required changes to i18next-parser.
🚀 Feature Proposal
A new API for specifying plurals in code, with explicit default messages for all plural forms.
Motivation
Many people's i18n workflow is to write default phrases in UI code with explicit keys with
t()
/<Trans />
, and then extract them with i18next-parser.Plurals make this very awkward because there's no way to extract additional plural forms from source code, so you must write one form in code, run i18n-parser, then go edit the json messages file with the additional forms. It also means there's no single source of truth for phrases, as additional plural forms would only live in the json messages file.
Example
I can't really see a great API for supporting this with the React
<Trans />
.If accepted, I'm happy to work on this and contribute it to i18next, and the required changes to i18next-parser.
See also i18next/i18next-parser#998
The text was updated successfully, but these errors were encountered: