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

Inline Component Translations in layers dont work in production #3498

Open
ThiloHettmer opened this issue Mar 31, 2025 · 15 comments
Open

Inline Component Translations in layers dont work in production #3498

ThiloHettmer opened this issue Mar 31, 2025 · 15 comments

Comments

@ThiloHettmer
Copy link

ThiloHettmer commented Mar 31, 2025

Environment


  • Operating System: Linux
  • Node Version: v20.17.0
  • Nuxt Version: 3.16.1
  • CLI Version: 3.23.1
  • Nitro Version: 2.11.8
  • Package Manager: [email protected]
  • Builder: -
  • User Config: modules, typescript, devtools, alias, compatibilityDate
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Reproduction

https://github.com/ThiloHettmer/nuxt-i18n-layer-issue

Run "make fresh" to clear, install, build and run production build.

Describe the bug

After updating to the latest i18n version our inline component translations do not work anymore in production. From what I can see they are bundled into the build, but it just does not work.

There are 6 different translations in the reproduction repo:

  • Directly in the index.vue: works
  • TestI18nInline: works
  • TestI18nJson: does not work
  • TestI18nYamlClient: works
  • TestI18nYamlServer: works
  • TestI18nYaml: does not work

We tried various configs in the nuxt.config, but nothing worked. We went through the unplugin-vue-i18n configs (https://github.com/intlify/bundle-tools/blob/main/packages/unplugin-vue-i18n/README.md) but also with not success.

Is this a bug, or are we doing something wrong?

Additional context

No response

Logs

> nuxt build

[ nuxi ] Nuxt 3.16.0 with Nitro 2.11.8
[nuxt:tailwindcss] ℹ Using default Tailwind CSS file
[ nuxi ] ℹ Building for Nitro preset: node-server
ℹ Building client...
ℹ vite v6.2.3 building for production...
ℹ transforming...
ℹ ✓ 207 modules transformed.
ℹ rendering chunks...
ℹ computing gzip size...
ℹ .nuxt/dist/client/manifest.json                   3.46 kB │ gzip:  0.51 kB
ℹ .nuxt/dist/client/_nuxt/error-500.CtUJL31h.css    1.88 kB │ gzip:  0.72 kB
ℹ .nuxt/dist/client/_nuxt/error-404.Dei1Rf7K.css    3.56 kB │ gzip:  1.10 kB
ℹ .nuxt/dist/client/_nuxt/C02kXKLQ.js               0.31 kB │ gzip:  0.23 kB
ℹ .nuxt/dist/client/_nuxt/t0ROv1s5.js               0.77 kB │ gzip:  0.30 kB
ℹ .nuxt/dist/client/_nuxt/C7tEpC3j.js               3.41 kB │ gzip:  1.54 kB
ℹ .nuxt/dist/client/_nuxt/XtENYyXQ.js               9.44 kB │ gzip:  3.77 kB
ℹ .nuxt/dist/client/_nuxt/DHOg_c_h.js              11.97 kB │ gzip:  5.23 kB
ℹ .nuxt/dist/client/_nuxt/C6qd_Il2.js             251.42 kB │ gzip: 92.34 kB
ℹ ✓ built in 1.40s
✔ Client built in 1410ms
ℹ Building server...
ℹ vite v6.2.3 building SSR bundle for production...
ℹ transforming...
ℹ ✓ 174 modules transformed.
ℹ rendering chunks...
ℹ .nuxt/dist/server/_nuxt/error-404-styles.BNmKahfp.mjs                                                                                                                                                                                      0.08 kB
ℹ .nuxt/dist/server/_nuxt/error-500-styles.Cx3AJg0u.mjs                                                                                                                                                                                      0.08 kB
ℹ .nuxt/dist/server/_nuxt/entry-styles.4FLa15rc.mjs                                                                                                                                                                                          0.14 kB
ℹ .nuxt/dist/server/styles.mjs                                                                                                                                                                                                               0.88 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/utils.mjs                                         0.13 kB │ map:   0.49 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/injections.mjs                         0.18 kB │ map:   0.52 kB
ℹ .nuxt/dist/server/_virtual/virtual_nuxt__home_thilo_Projects_kinoheld_tmp_i18n-issue-project_apps_app_.nuxt_layouts.mjs                                                                                                                    0.19 kB │ map:   0.38 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_vue_devtools-api_6.6.4/node_modules/_vue/devtools-api/lib/esm/const.mjs                                                                                                                              0.19 kB │ map:   0.40 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/uncrypto_0.1.3/node_modules/uncrypto/dist/crypto.node.mjs                                                                                                                                             0.24 kB │ map:   0.71 kB
ℹ .nuxt/dist/server/_virtual/_plugin-vue_export-helper.mjs                                                                                                                                                                                   0.25 kB │ map:   0.12 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/composables/payload.mjs                           0.28 kB │ map:   5.07 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/server-placeholder.mjs                 0.28 kB │ map:   0.66 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/ohash_2.0.11/node_modules/ohash/dist/index.mjs                                                                                                                                                        0.31 kB │ map:   0.58 kB
ℹ .nuxt/dist/server/apps/app/.nuxt/nuxt-i18n-logger.mjs                                                                                                                                                                                      0.32 kB │ map:   0.44 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_vue_devtools-api_6.6.4/node_modules/_vue/devtools-api/lib/esm/env.mjs                                                                                                                                0.33 kB │ map:   0.84 kB
ℹ .nuxt/dist/server/_virtual/virtual_nuxt__home_thilo_Projects_kinoheld_tmp_i18n-issue-project_apps_app_.nuxt_fetch.mjs                                                                                                                      0.35 kB │ map:   0.57 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/head/runtime/plugins/unhead.mjs                       0.39 kB │ map:   1.59 kB
ℹ .nuxt/dist/server/apps/app/components/test/i18n/inline.vue.mjs                                                                                                                                                                             0.44 kB │ map:   0.10 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/node-fetch-native_1.6.6/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs                                                                                                     0.44 kB │ map:   0.95 kB
ℹ .nuxt/dist/server/_virtual/virtual_nuxt__home_thilo_Projects_kinoheld_tmp_i18n-issue-project_apps_app_.nuxt_nuxt.config.mjs                                                                                                                0.45 kB │ map:   2.34 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/middleware/manifest-route-rule.mjs                0.45 kB │ map:   0.99 kB
ℹ .nuxt/dist/server/_virtual/virtual_nuxt__home_thilo_Projects_kinoheld_tmp_i18n-issue-project_apps_app_.nuxt_components.islands.mjs                                                                                                         0.46 kB │ map:   0.81 kB
ℹ .nuxt/dist/server/_virtual/virtual_nuxt__home_thilo_Projects_kinoheld_tmp_i18n-issue-project_apps_app_.nuxt_routes.mjs                                                                                                                     0.47 kB │ map:   2.02 kB
ℹ .nuxt/dist/server/apps/app/pages/index.vue3.mjs                                                                                                                                                                                            0.49 kB │ map:   0.11 kB
ℹ .nuxt/dist/server/apps/app/components/test/i18n/json.vue3.mjs                                                                                                                                                                              0.50 kB │ map:   0.11 kB
ℹ .nuxt/dist/server/apps/app/components/test/i18n/yaml.vue3.mjs                                                                                                                                                                              0.50 kB │ map:   0.11 kB
ℹ .nuxt/dist/server/apps/app/pages/index.vue.mjs                                                                                                                                                                                             0.51 kB │ map:   0.10 kB
ℹ .nuxt/dist/server/apps/app/components/test/i18n/json.vue.mjs                                                                                                                                                                               0.52 kB │ map:   0.10 kB
ℹ .nuxt/dist/server/apps/app/components/test/i18n/yaml.vue.mjs                                                                                                                                                                               0.52 kB │ map:   0.10 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_vue_devtools-api_6.6.4/node_modules/_vue/devtools-api/lib/esm/time.mjs                                                                                                                               0.54 kB │ map:   1.24 kB
ℹ .nuxt/dist/server/_virtual/virtual_nuxt__home_thilo_Projects_kinoheld_tmp_i18n-issue-project_apps_app_.nuxt_router.options.mjs                                                                                                             0.55 kB │ map:   0.89 kB
ℹ .nuxt/dist/server/apps/app/components/test/i18n/yaml-server.server.vue3.mjs                                                                                                                                                                0.55 kB │ map:   0.12 kB
ℹ .nuxt/dist/server/_virtual/virtual_nuxt__home_thilo_Projects_kinoheld_tmp_i18n-issue-project_apps_app_.nuxt_components.plugin.mjs                                                                                                          0.56 kB │ map:   0.49 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/ohash_2.0.11/node_modules/ohash/dist/crypto/node/index.mjs                                                                                                                                            0.56 kB │ map:   0.86 kB
ℹ .nuxt/dist/server/apps/app/components/test/i18n/yaml-server.server.vue.mjs                                                                                                                                                                 0.58 kB │ map:   0.12 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/node-fetch-native_1.6.6/node_modules/node-fetch-native/dist/index.mjs                                                                                                                                 0.58 kB │ map:   1.31 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/is-https_4.0.0/node_modules/is-https/dist/index.mjs                                                                                                                                                   0.65 kB │ map:   1.22 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/compatibility.mjs                     0.70 kB │ map:   1.41 kB
ℹ .nuxt/dist/server/_virtual/virtual_nuxt__home_thilo_Projects_kinoheld_tmp_i18n-issue-project_apps_app_.nuxt_middleware.mjs                                                                                                                 0.73 kB │ map:   1.05 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/composables/manifest.mjs                          0.75 kB │ map:   2.58 kB
ℹ .nuxt/dist/server/apps/app/components/test/i18n/json.vue2.mjs                                                                                                                                                                              0.75 kB │ map:   0.62 kB
ℹ .nuxt/dist/server/apps/app/components/test/i18n/yaml.vue2.mjs                                                                                                                                                                              0.75 kB │ map:   0.57 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/plugins/ssg-detect.mjs                0.79 kB │ map:   1.73 kB
ℹ .nuxt/dist/server/apps/app/components/test/i18n/yaml-server.server.vue2.mjs                                                                                                                                                                0.79 kB │ map:   0.64 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/head/runtime/composables/v3.mjs                       0.84 kB │ map:   2.27 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_vue_devtools-api_6.6.4/node_modules/_vue/devtools-api/lib/esm/index.mjs                                                                                                                              0.93 kB │ map:   1.72 kB
ℹ .nuxt/dist/server/apps/app/components/test/i18n/inline.vue2.mjs                                                                                                                                                                            0.94 kB │ map:   0.72 kB
ℹ .nuxt/dist/server/apps/app/.nuxt/i18n.options.mjs                                                                                                                                                                                          0.96 kB │ map:   3.01 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/composables/state.mjs                             1.00 kB │ map:   2.46 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/composables/index.mjs                 1.01 kB │ map:   5.40 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/route-provider.mjs                     1.03 kB │ map:   2.60 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/pages/runtime/utils.mjs                               1.05 kB │ map:   1.97 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/composables/error.mjs                             1.06 kB │ map:   2.21 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/island-renderer.mjs                    1.10 kB │ map:   1.81 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/composables/ssr.mjs                               1.13 kB │ map:   4.47 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/components/runtime/server-component.mjs               1.16 kB │ map:   3.17 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/cookie-es_2.0.0/node_modules/cookie-es/dist/index.mjs                                                                                                                                                 1.22 kB │ map:   8.51 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/ofetch_1.4.1/node_modules/ofetch/dist/node.mjs                                                                                                                                                        1.31 kB │ map:   2.21 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/pages/runtime/validate.mjs                            1.33 kB │ map:   2.03 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/utils.mjs                              1.35 kB │ map:   5.27 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/plugins/revive-payload.server.mjs                 1.35 kB │ map:   2.45 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/routing/i18n.mjs                      1.41 kB │ map:   2.66 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/plugins/switch-locale-path-ssr.mjs    1.47 kB │ map:   1.99 kB
ℹ .nuxt/dist/server/layers/base/i18n/i18n.config.mjs                                                                                                                                                                                         1.52 kB │ map:   2.73 kB
ℹ .nuxt/dist/server/apps/app/app.vue.mjs                                                                                                                                                                                                     1.61 kB │ map:   0.42 kB
ℹ .nuxt/dist/server/server.mjs                                                                                                                                                                                                               1.65 kB │ map:   3.61 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/defu_6.1.4/node_modules/defu/dist/defu.mjs                                                                                                                                                            1.66 kB │ map:   3.55 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/klona_2.0.6/node_modules/klona/dist/index.mjs                                                                                                                                                         1.70 kB │ map:   3.46 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/nuxt-error-page.vue.mjs                2.07 kB │ map:   2.71 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/pages/runtime/router.options.mjs                      2.08 kB │ map:   3.46 kB
ℹ .nuxt/dist/server/error-500-styles-1.mjs.mjs                                                                                                                                                                                               2.09 kB │ map:   0.11 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/destr_2.0.3/node_modules/destr/dist/index.mjs                                                                                                                                                         2.14 kB │ map:   3.83 kB
ℹ .nuxt/dist/server/apps/app/pages/index.vue2.mjs                                                                                                                                                                                            2.36 kB │ map:   0.62 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/consola_3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs                                                                                                                                   2.41 kB │ map:   4.55 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/composables/cookie.mjs                            2.61 kB │ map:   8.55 kB
ℹ .nuxt/dist/server/_virtual/virtual_nuxt__home_thilo_Projects_kinoheld_tmp_i18n-issue-project_apps_app_.nuxt_plugins.server.mjs                                                                                                             2.71 kB │ map:   3.47 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_vue_devtools-api_6.6.4/node_modules/_vue/devtools-api/lib/esm/proxy.mjs                                                                                                                              2.75 kB │ map:   5.87 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/nuxt-root.vue.mjs                      2.85 kB │ map:   3.83 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/messages.mjs                          2.94 kB │ map:   6.07 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/pages/runtime/page.mjs                                2.98 kB │ map:   9.81 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/plugins/route-locale-detect.mjs       3.40 kB │ map:   4.21 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/nuxt-layout.mjs                        3.49 kB │ map:   7.08 kB
ℹ .nuxt/dist/server/error-404-styles-1.mjs.mjs                                                                                                                                                                                               3.77 kB │ map:   0.11 kB
ℹ .nuxt/dist/server/entry-styles-1.mjs.mjs                                                                                                                                                                                                   3.94 kB │ map:   0.10 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/routing/utils.mjs                     4.06 kB │ map:   6.33 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/ohash_2.0.11/node_modules/ohash/dist/shared/ohash.D__AXeF1.mjs                                                                                                                                        4.38 kB │ map:   6.48 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/composables/router.mjs                            4.40 kB │ map:   9.93 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/error-500.vue.mjs                      4.59 kB │ map:   5.51 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/routing/routing.mjs                   4.97 kB │ map:   8.13 kB
ℹ .nuxt/dist/server/entry-styles-2.mjs.mjs                                                                                                                                                                                                   5.14 kB │ map:   0.10 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/error-404.vue.mjs                      5.47 kB │ map:   7.26 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_intlify_shared_10.0.6/node_modules/_intlify/shared/dist/shared.mjs                                                                                                                                   5.86 kB │ map:  13.61 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/node-fetch-native_1.6.6/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs                                                                                                               6.60 kB │ map:  10.88 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/consola_3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs                                                                                                                                   6.95 kB │ map:  14.93 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/routing/head.mjs                      6.96 kB │ map:  11.46 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/nuxt.mjs                                          7.09 kB │ map:  14.20 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/ufo_1.5.4/node_modules/ufo/dist/index.mjs                                                                                                                                                             8.00 kB │ map:  26.90 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/pages/runtime/plugins/router.mjs                      8.35 kB │ map:  13.75 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/plugins/i18n.mjs                      8.60 kB │ map:  12.75 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/nuxt-island.mjs                        8.86 kB │ map:  18.48 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/nuxt_3.16.0__parcel_watcher_2.5.1__types_node_22.10.1_db0_0.3.1_eslint_9.23.0_jiti_2.4.2__ior_bhscp3p3fqradtz2a7hwd6rt4q/node_modules/nuxt/dist/app/components/nuxt-link.mjs                          9.35 kB │ map:  19.84 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/utils.mjs                            10.08 kB │ map:  16.85 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/ofetch_1.4.1/node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs                                                                                                                                     10.92 kB │ map:  17.99 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_nuxtjs_i18n_9.4.0__vue_compiler-dom_3.5.13_eslint_9.23.0_jiti_2.4.2__magicast_0.3.5_rollup_4_y3oynor2wv4cmhcvuenvnfvofu/node_modules/_nuxtjs/i18n/dist/runtime/internal.mjs                         11.92 kB │ map:  18.83 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/consola_3.4.2/node_modules/consola/dist/core.mjs                                                                                                                                                     13.94 kB │ map:  23.02 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/consola_3.4.2/node_modules/consola/dist/index.mjs                                                                                                                                                    31.85 kB │ map:  51.11 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_intlify_message-compiler_11.1.2/node_modules/_intlify/message-compiler/dist/message-compiler.mjs                                                                                                    43.55 kB │ map:  87.03 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/vue-i18n_10.0.6_vue_3.5.13_typescript_5.7.3_/node_modules/vue-i18n/dist/vue-i18n.mjs                                                                                                                 46.07 kB │ map: 117.34 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/_intlify_core-base_10.0.6/node_modules/_intlify/core-base/dist/core-base.mjs                                                                                                                         49.71 kB │ map: 100.14 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/consola_3.4.2/node_modules/consola/dist/chunks/prompt.mjs                                                                                                                                            51.58 kB │ map:  81.75 kB
ℹ .nuxt/dist/server/node_modules/.pnpm/node-fetch-native_1.6.6/node_modules/node-fetch-native/dist/node.mjs                                                                                                                                153.63 kB │ map: 231.46 kB
ℹ ✓ built in 3.76s
✔ Server built in 3766ms
[nitro] ✔ Generated public .output/public
[nitro] ℹ Building Nuxt Nitro server (preset: node-server, compatibility date: 2025-03-19)
[nitro] ✔ Nuxt Nitro server built
  ├─ .output/server/chunks/_/error-500.mjs (4.77 kB) (2.02 kB gzip)
  ├─ .output/server/chunks/_/error-500.mjs.map (346 B) (262 B gzip)
  ├─ .output/server/chunks/build/client.manifest.mjs (4.27 kB) (632 B gzip)
  ├─ .output/server/chunks/build/client.manifest.mjs.map (2.18 kB) (414 B gzip)
  ├─ .output/server/chunks/build/entry-styles.4FLa15rc.mjs (9.07 kB) (1.73 kB gzip)
  ├─ .output/server/chunks/build/entry-styles.4FLa15rc.mjs.map (230 B) (178 B gzip)
  ├─ .output/server/chunks/build/error-404-styles.BNmKahfp.mjs (3.83 kB) (1.23 kB gzip)
  ├─ .output/server/chunks/build/error-404-styles.BNmKahfp.mjs.map (216 B) (167 B gzip)
  ├─ .output/server/chunks/build/error-404.vue.mjs (14.8 kB) (4.59 kB gzip)
  ├─ .output/server/chunks/build/error-404.vue.mjs.map (550 B) (271 B gzip)
  ├─ .output/server/chunks/build/error-500-styles.Cx3AJg0u.mjs (2.15 kB) (854 B gzip)
  ├─ .output/server/chunks/build/error-500-styles.Cx3AJg0u.mjs.map (216 B) (166 B gzip)
  ├─ .output/server/chunks/build/error-500.vue.mjs (4.96 kB) (2.06 kB gzip)
  ├─ .output/server/chunks/build/error-500.vue.mjs.map (337 B) (255 B gzip)
  ├─ .output/server/chunks/build/i18n.config.mjs (1.52 kB) (390 B gzip)
  ├─ .output/server/chunks/build/i18n.config.mjs.map (1.54 kB) (370 B gzip)
  ├─ .output/server/chunks/build/index.vue.mjs (12.9 kB) (3.77 kB gzip)
  ├─ .output/server/chunks/build/index.vue.mjs.map (1.24 kB) (401 B gzip)
  ├─ .output/server/chunks/build/island-renderer.mjs (1.61 kB) (691 B gzip)
  ├─ .output/server/chunks/build/island-renderer.mjs.map (482 B) (336 B gzip)
  ├─ .output/server/chunks/build/prompt.mjs (51.6 kB) (13.1 kB gzip)
  ├─ .output/server/chunks/build/prompt.mjs.map (262 B) (191 B gzip)
  ├─ .output/server/chunks/build/server.mjs (275 kB) (64.8 kB gzip)
  ├─ .output/server/chunks/build/server.mjs.map (11.2 kB) (1.61 kB gzip)
  ├─ .output/server/chunks/build/styles.mjs (935 B) (363 B gzip)
  ├─ .output/server/chunks/build/styles.mjs.map (419 B) (218 B gzip)
  ├─ .output/server/chunks/build/v3.mjs (710 B) (368 B gzip)
  ├─ .output/server/chunks/build/v3.mjs.map (338 B) (259 B gzip)
  ├─ .output/server/chunks/build/yaml-server.server.vue.mjs (1.8 kB) (771 B gzip)
  ├─ .output/server/chunks/build/yaml-server.server.vue.mjs.map (303 B) (188 B gzip)
  ├─ .output/server/chunks/nitro/nitro.mjs (165 kB) (41 kB gzip)
  ├─ .output/server/chunks/nitro/nitro.mjs.map (4.99 kB) (1.04 kB gzip)
  ├─ .output/server/chunks/routes/renderer.mjs (18.4 kB) (5.53 kB gzip)
  ├─ .output/server/chunks/routes/renderer.mjs.map (1.58 kB) (403 B gzip)
  ├─ .output/server/chunks/virtual/_virtual_spa-template.mjs (94 B) (100 B gzip)
  ├─ .output/server/chunks/virtual/_virtual_spa-template.mjs.map (112 B) (111 B gzip)
  ├─ .output/server/index.mjs (353 B) (204 B gzip)
  └─ .output/server/package.json (566 B) (291 B gzip)
Σ Total size: 2.2 MB (539 kB gzip)
[nitro] ✔ You can preview this build using node .output/server/index.mjs
make[1]: Leaving directory '/home/thilo/Projects/kinoheld/tmp/i18n-issue-project'
make[1]: Entering directory '/home/thilo/Projects/kinoheld/tmp/i18n-issue-project'
cd apps/app && node .output/server/index.mjs
Listening on http://[::]:3000
[i18n:plugin:i18n] isSSG false
[i18n:plugin:i18n] useCookie on setup false
[i18n:plugin:i18n] defaultLocale on setup de
[i18n:extendBaseUrl] using runtimeConfig - { baseUrl: 'https://www.test.de' }
[i18n:getLocaleCookie:server] { useCookie: false, cookieKey: false, localeCodes: [ 'de', 'en' ] }
[i18n:detectLocale] { detectBrowserLanguage: { locale: '', reason: 'disabled' } }
[i18n:detectLocale] 1/3 { detected: '', strategy: 'prefix_except_default' }
[i18n:detectLocale] 2/3 { detected: 'de', detectBrowserLanguage: false }
[i18n:detectLocale] 3/3 { detected: 'de',
  cookieLocale: undefined,
  defaultLocale: 'de',
  localeCookie: undefined }
[i18n:loadAndSetLocale] { newLocale: 'de', oldLocale: 'de', initial: true }
[i18n:plugin:route-locale-detect] locale-changing middleware { fullPath: '/',
  hash: '',
  query: {},
  name: 'index___de',
  path: '/',
  params: {},
  matched:
   [ { path: '/',
       redirect: undefined,
       name: 'index___de',
       meta: {},
       aliasOf: undefined,
       beforeEnter: undefined,
       props: [Object],
       children: [],
       instances: {},
       leaveGuards: Set(0) {},
       updateGuards: Set(0) {},
       enterCallbacks: {},
       components: [Object] } ],
  meta: {},
  redirectedFrom: undefined,
  href: '/' } { fullPath: '/',
  path: '/',
  query: {},
  hash: '',
  name: undefined,
  params: {},
  matched:
   [ { path: '/',
       redirect: undefined,
       name: 'index___de',
       meta: {},
       aliasOf: undefined,
       beforeEnter: undefined,
       props: [Object],
       children: [],
       instances: {},
       leaveGuards: Set(0) {},
       updateGuards: Set(0) {},
       enterCallbacks: {},
       components: [Object] } ],
  meta: {},
  redirectedFrom: undefined,
  href: '/' }
[i18n:getLocaleCookie:server] { useCookie: false, cookieKey: false, localeCodes: [ 'de', 'en' ] }
[i18n:detectLocale] { detectBrowserLanguage: { locale: '', reason: 'disabled' } }
[i18n:detectLocale] 1/3 { detected: '', strategy: 'prefix_except_default' }
[i18n:detectLocale] 2/3 { detected: 'de', detectBrowserLanguage: false }
[i18n:detectLocale] 3/3 { detected: 'de',
  cookieLocale: undefined,
  defaultLocale: 'de',
  localeCookie: undefined }
[i18n:loadAndSetLocale] { newLocale: 'de', oldLocale: 'de', initial: true }
[i18n:plugin:route-locale-detect] redirectPath on locale-changing middleware 
[i18n:navigate] options { rootRedirect: '',
  differentDomains: false,
  skipSettingLocaleOnNavigate: false,
  enableNavigate: false,
  isSSG: false }
[i18n:plugin:i18n] isSSG false
[i18n:plugin:i18n] useCookie on setup false
[i18n:plugin:i18n] defaultLocale on setup de
[i18n:extendBaseUrl] using runtimeConfig - { baseUrl: 'https://www.test.de' }
[i18n:getLocaleCookie:server] { useCookie: false, cookieKey: false, localeCodes: [ 'de', 'en' ] }
[i18n:detectLocale] { detectBrowserLanguage: { locale: '', reason: 'disabled' } }
[i18n:detectLocale] 1/3 { detected: '', strategy: 'prefix_except_default' }
[i18n:detectLocale] 2/3 { detected: 'de', detectBrowserLanguage: false }
[i18n:detectLocale] 3/3 { detected: 'de',
  cookieLocale: undefined,
  defaultLocale: 'de',
  localeCookie: undefined }
[i18n:loadAndSetLocale] { newLocale: 'de', oldLocale: 'de', initial: true }
[i18n:plugin:i18n] isSSG false
[i18n:plugin:i18n] useCookie on setup false
[i18n:plugin:i18n] defaultLocale on setup de
[i18n:extendBaseUrl] using runtimeConfig - { baseUrl: 'https://www.test.de' }
[i18n:getLocaleCookie:server] { useCookie: false, cookieKey: false, localeCodes: [ 'de', 'en' ] }
[i18n:detectLocale] { detectBrowserLanguage: { locale: '', reason: 'disabled' } }
[i18n:detectLocale] 1/3 { detected: '', strategy: 'prefix_except_default' }
[i18n:detectLocale] 2/3 { detected: 'de', detectBrowserLanguage: false }
[i18n:detectLocale] 3/3 { detected: 'de',
  cookieLocale: undefined,
  defaultLocale: 'de',
  localeCookie: undefined }
[i18n:loadAndSetLocale] { newLocale: 'de', oldLocale: 'de', initial: true }
[i18n:plugin:route-locale-detect] locale-changing middleware { fullPath: '/',
  hash: '',
  query: {},
  name: 'index___de',
  path: '/',
  params: {},
  matched:
   [ { path: '/',
       redirect: undefined,
       name: 'index___de',
       meta: {},
       aliasOf: undefined,
       beforeEnter: undefined,
       props: [Object],
       children: [],
       instances: {},
       leaveGuards: Set(0) {},
       updateGuards: Set(0) {},
       enterCallbacks: {},
       components: [Object] } ],
  meta: {},
  redirectedFrom: undefined,
  href: '/' } { fullPath: '/',
  path: '/',
  query: {},
  hash: '',
  name: undefined,
  params: {},
  matched:
   [ { path: '/',
       redirect: undefined,
       name: 'index___de',
       meta: {},
       aliasOf: undefined,
       beforeEnter: undefined,
       props: [Object],
       children: [],
       instances: {},
       leaveGuards: Set(0) {},
       updateGuards: Set(0) {},
       enterCallbacks: {},
       components: [Object] } ],
  meta: {},
  redirectedFrom: undefined,
  href: '/' }
[i18n:getLocaleCookie:server] { useCookie: false, cookieKey: false, localeCodes: [ 'de', 'en' ] }
[i18n:detectLocale] { detectBrowserLanguage: { locale: '', reason: 'disabled' } }
[i18n:detectLocale] 1/3 { detected: '', strategy: 'prefix_except_default' }
[i18n:detectLocale] 2/3 { detected: 'de', detectBrowserLanguage: false }
[i18n:detectLocale] 3/3 { detected: 'de',
  cookieLocale: undefined,
  defaultLocale: 'de',
  localeCookie: undefined }
[i18n:loadAndSetLocale] { newLocale: 'de', oldLocale: 'de', initial: true }
[i18n:plugin:route-locale-detect] redirectPath on locale-changing middleware 
[i18n:navigate] options { rootRedirect: '',
  differentDomains: false,
  skipSettingLocaleOnNavigate: false,
  enableNavigate: false,
  isSSG: false }
[i18n:plugin:i18n] isSSG false
[i18n:plugin:i18n] useCookie on setup false
[i18n:plugin:i18n] defaultLocale on setup de
[i18n:extendBaseUrl] using runtimeConfig - { baseUrl: 'https://www.test.de' }
[i18n:getLocaleCookie:server] { useCookie: false, cookieKey: false, localeCodes: [ 'de', 'en' ] }
[i18n:detectLocale] { detectBrowserLanguage: { locale: '', reason: 'disabled' } }
[i18n:detectLocale] 1/3 { detected: '', strategy: 'prefix_except_default' }
[i18n:detectLocale] 2/3 { detected: 'de', detectBrowserLanguage: false }
[i18n:detectLocale] 3/3 { detected: 'de',
  cookieLocale: undefined,
  defaultLocale: 'de',
  localeCookie: undefined }
[i18n:loadAndSetLocale] { newLocale: 'de', oldLocale: 'de', initial: true }
@ThiloHettmer ThiloHettmer changed the title Inline Component Translations in layers dont work Inline Component Translations in layers dont work in production Mar 31, 2025
@ThiloHettmer
Copy link
Author

I have checked the build and I see:

function pt(e) {
    const t = e;
    t.__i18n = t.__i18n || [],
    t.__i18n.push({
        locale: "",
        resource: {
            de: {
                "test-yaml": {
                    t: 0,
                    b: {
                        t: 2,
                        i: [{
                            t: 3
                        }],
                        s: "Das ist ein yaml String"
                    }
                }
            },
            en: {
                "test-yaml": {
                    t: 0,
                    b: {
                        t: 2,
                        i: [{
                            t: 3
                        }],
                        s: "That is an yaml string"
                    }
                }
            }
        }
    })
}

Which means it is in the build but does not get used at all

@BobbieGoede
Copy link
Collaborator

What version were you on before updating nuxt-i18n to latest?

@ThiloHettmer
Copy link
Author

8.0.0-beta.10

@luke-z
Copy link

luke-z commented Apr 1, 2025

I have a similar problem where the local translations don't load during ssr. They are then loaded client side with a hydration error in the browser console. It only affects the translations in components but works when used directly in layouts or pages. We're using version 9.4.0 and <i18n lang="json">.

@ThiloHettmer
Copy link
Author

ThiloHettmer commented Apr 1, 2025

Ok, we digged into that topic more and we found out that as soon as we use <i18n> and <script setup lang="ts"> it bricks the translation in production. We still investigating if maybe unplugin-vue-i18n parses it wrong.
But for now it seems like customBlocks dont work with composition api and typescript.

@BobbieGoede
Copy link
Collaborator

BobbieGoede commented Apr 1, 2025

I haven't found the source of this behavior yet, but for some reason the translations do work in the build when using template interpolation instead of the v-text directive 🤔

<span v-text="t('test-json')" class="text-3xl" /> <!-- failure in build  -->
<span class="text-3xl"> {{ t('test-json') }} </span> <!-- works in build -->

@ThiloHettmer
Copy link
Author

ThiloHettmer commented Apr 2, 2025

Alright, what a journey...

I have semi fixed it by adding compiler transformation in the nuxt config and a custom directive as plugin to handle v-text.

nuxt.config.ts

import type { DirectiveNode } from '@vue/compiler-core'
import { NodeTypes } from '@vue/compiler-core'

...

  plugins: ['~/plugins/i18n-directive.ts'],
  vite: {
    vue: {
      template: {
        compilerOptions: {
          nodeTransforms: [
            (node) => {
              if (
                node.type === NodeTypes.ELEMENT &&
                node.props?.some(
                  (prop) =>
                    prop.type === NodeTypes.DIRECTIVE && prop.name === 'text',
                )
              ) {
                const textDirective = node.props.find(
                  (p): p is DirectiveNode =>
                    p.type === NodeTypes.DIRECTIVE && p.name === 'text',
                )
                const exp = textDirective?.exp

                if (exp?.type === NodeTypes.COMPOUND_EXPRESSION) {
                  const children = exp.children?.map((c) =>
                    typeof c === 'string'
                      ? c
                      : typeof c === 'symbol'
                        ? c.toString()
                        : 'content' in c
                          ? c.content
                          : '',
                  )
                  if (children?.[0] === '_unref(t)') {
                    node.props = node.props.map((prop) => {
                      if (
                        prop.type === NodeTypes.DIRECTIVE &&
                        prop.name === 'text'
                      ) {
                        return { ...prop, name: 'i18n-text' }
                      }
                      return prop
                    })
                  }
                } else if (
                  exp?.type === NodeTypes.SIMPLE_EXPRESSION &&
                  exp.content.startsWith('_unref')
                ) {
                  node.props = node.props.map((prop) => {
                    if (
                      prop.type === NodeTypes.DIRECTIVE &&
                      prop.name === 'text'
                    ) {
                      return { ...prop, name: 'i18n-text' }
                    }
                    return prop
                  })
                }
              }
            },
          ],
        },
      },
    },
  },

plugins/i18n-directive.ts

import { defineNuxtPlugin } from '#app'
import type { DirectiveBinding } from 'vue'
import { unref } from 'vue'

export default defineNuxtPlugin({
  name: 'i18n-directive',
  enforce: 'post',
  setup(nuxtApp) {
    nuxtApp.vueApp.directive('i18n-text', {
      beforeMount(el: HTMLElement, binding: DirectiveBinding) {
        const value = unref(binding.value)
        el.textContent = String(value ?? '')
      },
      updated(el: HTMLElement, binding: DirectiveBinding) {
        const value = unref(binding.value)
        el.textContent = String(value ?? '')
      },
    })
  },
})

It's not pretty, but it works (semi). I have updated the reproduction repository with a new branch that adds the plugin. The server component does not work anymore, but I think it's the right direction.

edit: This solution is not ment to be used, as it opens up way more issues. For example it is not possible to pass in a translated text as prop to another component (aka a button or similar).

@ThiloHettmer
Copy link
Author

Are there any new informations on this? It's kind of urgent for us, we might need to revert to v8

@TimGonnet
Copy link

Same here, we can't upgrade nuxt version to 3.16 because of that

@fraaalk
Copy link

fraaalk commented Apr 7, 2025

Having the same issue, maybe @danielroe @BobbieGoede have a brilliant idea or workaround?

@BobbieGoede
Copy link
Collaborator

@TimGonnet @fraaalk
Are you also migrating from v8? Could you share what version you were on previously? 🙏

And are you also experiencing this issue specifically using v-text directives vs template interpolation (see #3498 (comment))?

This may be a regression in nuxt-i18n but could also be a breaking change from a dependency, like @intlify/unplugin-vue-i18n. More information would be helpful to pinpoint and debug this.

@TimGonnet
Copy link

We were on 9.0.0-rc.2

Yes we experiencing this issue specifically using v-text directives

I think it's the same issue as #3505

@danielroe
Copy link
Contributor

I wonder if this is the same issue as nuxt/nuxt#31673

@fraaalk
Copy link

fraaalk commented Apr 7, 2025

As mentioned by @ThiloHettmer the issue can be pinned down to <script lang="ts" setup> usage in components, without lang="ts" everything runs fine it seems.

[email protected]
[email protected]

i can provide a minimal reproduction, if needed but i tested it with the already linked repo and can confirm it.

@BobbieGoede
Copy link
Collaborator

I am unable to reproduce this using the provided reproduction after updating to latest version of @nuxtjs/i18n but downgrading nuxt to 3.15.1. Using nuxt 3.16.x results in the broken behavior so this is more likely a regression in nuxt, perhaps the same issue as referenced by Daniel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants