lokalise / i18n-ally

🌍 All in one i18n extension for VS Code
https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally
MIT License
3.91k stars 309 forks source link

Support for plurals in i18next v21 #688

Open dantman opened 2 years ago

dantman commented 2 years ago

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 commented 2 years ago

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

AmruthPillai commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Same issue here.

auduongtuan commented 1 year ago

is there any update on this issue?

JulesLecuir commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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

alpenhannes commented 8 months ago

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 commented 6 months ago

Linking this bug: https://github.com/lokalise/i18n-ally/issues/1002

youssdevx commented 3 months ago

The issue is still not fixed