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

i18next plugin parser does not support plurals #1069

Closed
NilsJacobsen opened this issue Jul 12, 2023 · 6 comments
Closed

i18next plugin parser does not support plurals #1069

NilsJacobsen opened this issue Jul 12, 2023 · 6 comments
Assignees
Labels
scope: inlang/plugins Related to plugins (not necessarily inlang source code). type: improvement Something that can be improved.

Comments

@NilsJacobsen
Copy link
Member

This problem was comming up in this PR: mifi/lossless-cut#1653

Problem

i18next has pluarls support -> https://www.i18next.com/translation-function/plurals

  • You need to suffix the key with _one, _many ... (there are multiple options)
  • The frontend code should look for a count option in the t function t('key', {count: 1})

The current implementation of the parser is just passing the key, causing the ide extension to handle the wrong key.

Proposal

Improve the plugin parser to recognize the count option as the ns option and suffix the key.

@inlang/plugins @inlang/ide-extension

@maige-app maige-app bot added type: bug Something isn't working scope: inlang/plugins Related to plugins (not necessarily inlang source code). labels Jul 12, 2023
@NilsJacobsen NilsJacobsen added type: improvement Something that can be improved. and removed type: bug Something isn't working labels Jul 12, 2023
@samuelstroschein
Copy link
Member

samuelstroschein commented Jul 12, 2023

Inlang core eventually needs plugralization support.

If you can hack something in the plugin, great. If not, we gotta prioritize adding plurals to the AST in core.

@samuelstroschein
Copy link
Member

@NilsJacobsen I assigned you because we need to default assign issues to ensure they get handled

@felixhaeberle
Copy link
Contributor

@NilsJacobsen @NiklasBuchfink @samuelstroschein Great to see that the Message format we adopted now supports plurals ootb. We can now go ahead and improve the plugin parser.

@NiklasBuchfink
Copy link
Member

I close this as the infrastructure now allows the implementation of plurals

@samuelstroschein
Copy link
Member

@NiklasBuchfink but the i18next plugin doesn't parse plurals :)

@samuelstroschein samuelstroschein changed the title plugin parser does not support plurals i18nnext plugin parser does not support plurals Sep 11, 2023
@NiklasBuchfink NiklasBuchfink changed the title i18nnext plugin parser does not support plurals i18next plugin parser does not support plurals Sep 11, 2023
@NiklasBuchfink
Copy link
Member

@samuelstroschein We should introduce this feature for all apps and plugins together. Until then, nothing will happen in this issue.

@samuelstroschein samuelstroschein closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: inlang/plugins Related to plugins (not necessarily inlang source code). type: improvement Something that can be improved.
Projects
None yet
Development

No branches or pull requests

4 participants