i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Per-component translations are not available in ssr in the build mode

Open ryinner opened this issue 9 months ago • 3 comments

Environment

  • Operating System: Linux
  • Node Version: v23.10.0
  • Nuxt Version: 3.16.1
  • CLI Version: 3.23.1
  • Nitro Version: 2.11.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools, modules, i18n
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

https://github.com/ryinner/nuxt-i18n-per-components-error

npm run build
node .output/server/index.mjs

Describe the bug

I have a child component Test that is called on the page. It contains a per-component translation and I expect these messages to be used during SSR, but I get a placeholder as if these messages are unavailable.

At the same time, everything is fine in dev mode.

Expected double TEST EN

Image

BUT

Image

This error is only in the components/, if I try to move them to the pages/, then everything will be fine.

Additional context

No response

Logs


ryinner avatar Apr 02 '25 11:04 ryinner

Update: if i will remove lang="ts" i have two TEST EN

ryinner avatar Apr 02 '25 11:04 ryinner

Same happening for me.

Current workaround is to either pass them as props from the page to the component or use global translations for components...

luke-z avatar Apr 04 '25 10:04 luke-z

same for me

minseokhappylee avatar Apr 17 '25 23:04 minseokhappylee