lokalise / i18n-ally

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

Multiple `t` functions not registered #1076

Open Onurfesci opened 9 months ago

Onurfesci commented 9 months ago

Describe the bug When I have multiple translation function in the same component, such as const t = useTranslations('namespace') and const tCommon = useTranslations('common'), they are not parsed properly by the extension and the incorrect namespace is searched for the corresponding translation.

I have tried adding a custom usageMatchAppend regex, but it still only registers the last usage of useTranslation for all of the translation functions.

Extension Version v2.12.0

Framework/i18n package you are using next-intl

To Reproduce Steps to reproduce the behavior:

  1. Create a component with more than one translation function
  2. Use one of the functions and hover over
  3. Hint only shows for the one called t specifically and claims the key is not found in the namespace from the other useTranslation namespace

Device Infomation

Extension Log Go to View -> Output -> i18n Ally, and paste the content below. You should mask any sensitive information

πŸ”„ Update usage cache of /Users/onur/repos/webapp-customer-react/apps/webapp-customer/src/components/InfoCard/InfoCard.tsx
πŸ”„ Update usage cache of /Users/onur/repos/webapp-customer-react/apps/webapp-customer/src/components/InfoCard/InfoCard.tsx
πŸ”„ Update usage cache of /Users/onur/repos/webapp-customer-react/apps/webapp-customer/src/components/InfoCard/InfoCard.tsx
πŸ”„ Update usage cache of /Users/onur/repos/webapp-customer-react/apps/webapp-customer/src/components/InfoCard/InfoCard.tsx
πŸ”„ Update usage cache of /Users/onur/repos/webapp-customer-react/apps/webapp-customer/src/components/InfoCard/InfoCard.tsx
πŸ”„ Update usage cache of /Users/onur/repos/webapp-customer-react/apps/webapp-customer/src/components/InfoCard/InfoCard.tsx

Screenshots image

felixhaeberle commented 9 months ago

@codesfromshad hey, as i18n-ally seems unmaintained and nobody is answering the issues here, I would advise you to use the inlang vscode extension: https://marketplace.visualstudio.com/items?itemName=inlang.vs-code-extension – we offer exactly what you are asking for.

It also has an integration guide on the next-intl website: https://next-intl-docs.vercel.app/docs/workflows/vscode-integration#inlang

PS: I'm the maintainer of the inlang extension; we're happy to work with our community to make the extension better every day in our discord: https://discord.com/channels/897438559458430986/1084866749842870333