marhali / easy-i18n

This is a IntelliJ IDE based plugin for internationalization. Supports the most common translation file types.
MIT License
87 stars 27 forks source link

JS Namespaces #304

Open jegork opened 1 year ago

jegork commented 1 year ago

I am using the plugin together with tolgee-js library for Next.js.

Currently, if I use the hook

const {t} = useTranslate('ns');

then, when using the t function, in the suggestions popup, I will have something like ns:key1, however the correct suggestion would be just key1 (no need to provide namespace, it doesn't work like that)

Example:

image
igorsantos07 commented 1 year ago

The plugin indeed needs more flexibility with namespaces.

Our current setup is locales/«locale»/translation.json, where translation is supposedly our default and only namespace, and thus is not needed. However, it gets shoved in the keys when checking the table view, what makes it mostly useless for us right now. This also causes all translations to look like they're not filled, since the end key generated by the plugin differs from what's on the files.

igorsantos07 commented 1 year ago

I'm not sure if this is also related, but the plugin shows autocomplete options even where it makes no sense at all:

  1. it's not a string, this is a property inside an object
  2. it's not inside a translation function

image

PS: notice the unnecessary namespaces, weirdly escaped.