lokalise / i18n-ally

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

Key not found when next-intl/server getTranslations() initialized with a namespace #1171

Open josegutierro opened 4 weeks ago

josegutierro commented 4 weeks ago

Describe the bug When you initialize the function getTranslations of the package next-intl/server with a namespace 18n-ally plugins can't find the key.

Extension Version VS Code extension v2.12.0

Framework/i18n package you are using next-inlt version ^3.12.2 with Next.js App Router version 14.0.4

To Reproduce Steps to reproduce the behavior:

  1. Define a messages/en.json like this: { "search-page": { "no-results-title": "No results found", } }
  2. Get the translations on your server component const t = await getTranslations('searchPage')
  3. Use this translation {t('no-results-title')}
  4. The key is not found. I think that i18n-ally plugin expects {t('search-page.no-results-title')} but in this case the translation is not working because you are already defining the namespace on the getTranslation function initialization.

Device Infomation

Extension Log 🈶 Activated, v2.12.0

――――――

💼 Workspace root changed to "****" 📦 Packages file "package.json" found 🕳 Packages file "pubspec.yaml" not exists 🕳 Packages file "composer.json" not exists 🕳 Packages file "Gemfile" not exists 🌞 Enabled 🧩 Enabled frameworks: next-intl, General 🧬 Enabled parsers: json, yaml, json5

📈 Telemetry id: 092f1961-0e1a-470b-aeaf-3df2555b405e 🚀 Initializing loader "****" 📂 Directory structure: file 🗃 Path Matcher Regex: /^(?[\w-_]+).(?json|ya?ml|json5)$/

📂 Loading locales under **/messages 📑 Loading (en) en.json [1718961218826.132] 📑 Loading (es) es.json [1718960271564.1414] 📑 Loading (pt) pt.json [1718960257962.0525]

👀 Watching change on **/messages ✅ Loading finished

――――――

ellisio commented 4 weeks ago

Looks like a duplicate of #1170.