nyavro / i18nPlugin

Intellij idea i18next support plugin
MIT License
70 stars 11 forks source link

Support i18next JSON v4 format #192

Open alexander-lebed opened 1 year ago

alexander-lebed commented 1 year ago

Thank you for an awesome plugin, I love it!

Recently I migrated my translation keys to new i18next JSON v4 format, but in WebStorm I cannot navigate to such keys anymore and shows it as Unresolved key.

"item" => "item_one"
"item_plural" => "item_other",

image

nyavro commented 1 year ago

Thanks for report! I'll take a look

nyavro commented 1 year ago

@alexander-lebed are there any changes in json file extensions? JSON v4 looks pretty much the same as older JSON formats, at least in it's structure. So my guess is that your json files have format other than 'json' or 'json5' which are supported by the plugin, so the plugin simply does not see them.

MadMind commented 5 months ago

Got the same "Unresolved key" issue with the v4 pluralization keys. For example t('keyName', {count: 5}) shows error, but the translation works as expected.

Translation file example:

{
  "keyName_zero": "{{count}} items",
  "keyName_one": "{{count}} item",
  "keyName_many": "{{count}} items"
}

Docs for reference: https://www.i18next.com/translation-function/plurals#languages-with-multiple-plurals