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

Support for plurals in i18next v21 #688

Open
dantman opened this issue Nov 5, 2021 · 13 comments · Fixed by #871
Open

Support for plurals in i18next v21 #688

dantman opened this issue Nov 5, 2021 · 13 comments · Fixed by #871

Comments

@dantman
Copy link
Contributor

dantman commented Nov 5, 2021

Is your feature related to a specific framework or general for this extension
i18next (v21)

Is your feature request related to a problem? Please describe.
If you upgrade to i18next@21 and migrate your messages to the new plural structure i18n Ally will no longer display the message when it's used and will list the valid key under "Keys not found".

Describe the solution you'd like
When a key has plurals (_other, _one, etc) display one of those plurals instead of listing the key as nonexistent.

Alternatively i18n Ally could be made smart enough to know about all forms of plurals and allow you to see and edit all of them.

Additional context
i18next changed it's plural API. Previously {key} was singular and {key}_plural was plural. So i18n Ally would just display the message at {key}.

The new API is based on the return of the Intl.PluralRules API. Instead {key}_one is singular and {key}_other is plural. As a result there is no longer a single key that exactly matches the key used in t('key') and i18n Ally lists {key} as nonexistent even though it does exist, it just has plurals.

https://www.i18next.com/translation-function/plurals

@dantman
Copy link
Contributor Author

dantman commented Dec 17, 2021

Setting i18n-ally.usage.derivedKeyRules also doesn't seem to work.

@AmruthPillai
Copy link

Was this fixed? Because it looks like even on the latest versions, the extension is unable to detect _one or _other keys even though they exist in all locales.

@JulesLecuir
Copy link

Same issue here. Struggling to use i18n ally with i18next 21.x.x caue it makes all my code full of red stuff, not pretty at all

@marviobezerra
Copy link

Same issue here.

@auduongtuan
Copy link

is there any update on this issue?

@JulesLecuir
Copy link

I am interested as well! It's a pain to have constant errors in my Jetbrains interface just because plurals and contexts are not properly supported...

@terales terales reopened this May 17, 2023
@terales
Copy link
Collaborator

terales commented May 17, 2023

I seems that the issue was not fixed yet, reopened.

I am interested as well! It's a pain to have constant errors in my Jetbrains interface just because plurals and contexts are not properly supported...

@JulesLecuir can you report the JetBrains plugin issue as a separate one in this repository, please?
https://github.com/lokalise/i18n-ally-jetbrains-docs

@JulesLecuir
Copy link

@terales Not sure to understand. My issue is not about docs, rather about i18n-ally not detecting more complex forms of plurals or with context attributes for example. It does not have something to do with docs I guess. So I am wondering if i18n-ally-jetbrains-docs is the right repo to post my issue. Can you confirm ? Thanks !

@ruiaraujo012
Copy link

I'm interested in it as well. Any update?

@alpenhannes
Copy link

We're experiencing the same issue still after migrating to the new plural structure. Any updates or progress on this? I haven't found a workaround for this yet either so if anyone knows of one, please let me know.

@keithrfung
Copy link

Linking this bug: #1002

@youssdevx
Copy link

The issue is still not fixed

@TzviPM
Copy link

TzviPM commented Nov 1, 2024

Setting i18n-ally.usage.derivedKeyRules does indeed work for me. The support is only to disable the keys from showing as missing keys, though. It would be great to get better support for associating the general "{key}" with "{key_one", "{key}_other", etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment