Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
josegutierro opened this issue Jun 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@josegutierro
Copy link

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

  • OS: MacOS
  • Version: Ventura 13.4.1
  • VS Code Version: 1.90.1

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

――――――


@josegutierro josegutierro added the bug Something isn't working label Jun 21, 2024
@ellisio
Copy link

ellisio commented Jun 21, 2024

Looks like a duplicate of #1170.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants