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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract plurals from code #998

Open
joshhunt opened this issue Apr 17, 2024 · 0 comments
Open

Extract plurals from code #998

joshhunt opened this issue Apr 17, 2024 · 0 comments

Comments

@joshhunt
Copy link

馃殌 Feature Proposal

I would like to extract all plural forms from the code, rather than only a single form, and then having to update the .json file with other plural forms

I'm not exactly sure of the API for this, and whether it would require additions to i18next core.

Motivation

So we have one single way for developers to write phrases, and plurals are properly translated.

Example

Perhaps, something like:

t.plural("folder-count", {
  one: "{{count}} folder",
  other: "{{count}} folders",
}, { count })

Which, after running i18next-parser, would output

{
  "folder-count_one": "{{count}} folder",
  "folder-count_other": "{{count}} folders",
}

A similar API could exist for <Trans /> as well.

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

No branches or pull requests

1 participant