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

when use array type module configuraion, i18n-t tag and pluralisation don't work on production build #2089

Closed
gbyesiltas opened this issue May 19, 2023 · 4 comments · Fixed by #2148
Labels
config help wanted 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage PR Welcome v8

Comments

@gbyesiltas
Copy link

gbyesiltas commented May 19, 2023

Environment

  • Operating System: Darwin
  • Node Version: v18.14.0
  • Nuxt Version: 3.5.0
  • Nitro Version: 2.4.1
  • Package Manager: npm@8.19.3
  • Builder: vite
  • User Config: ssr, components, runtimeConfig, modules, app, css, postcss, vite
  • Runtime Modules: nuxt-vitest@0.7.0, @nuxt-alt/auth@2.5.0, @pinia/nuxt@0.4.9, nuxt-icon@0.4.0, @vueuse/nuxt@9.13.0, @formkit/nuxt@0.17.0, @nuxtjs/i18n@8.0.0-beta.11, @nuxt/image-edge@1.0.0-28020728.5df24eb, @nuxtjs/robots@3.0.0
  • Build Modules: -

Reproduction

Here's a stackblitz reproduction with only this module as a dependency: https://stackblitz.com/edit/github-mqaaqa-zzgq5f?file=app.vue

Describe the bug

Translations that include pluralisations and translations via the i18n-t tag do not work when the application is built using npm run build and npm run preview whereas they do work on the development build.

Additional context

No response

Logs

No response

@JasonLandbridge
Copy link

Same issue here, this is blocking deployment unfortunately. I am on exactly the same environment as @gbyesiltas

@Xezard
Copy link

Xezard commented May 19, 2023

image

I confirm that the bug is relevant for the following configuration:
"@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge",
"nuxt": "3.5.0"

The bug seriously blocks the release of the project in production(

UPD 21.05.2023: the replacement of variables in translations also does not work with the production build:
image
along with this, the following error periodically appears in the server console: [intlify] The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format.

@gbyesiltas gbyesiltas changed the title i18n-t tag and pluralisation doesn't work on production build i18n-t tag and pluralisation don't work on production build May 22, 2023
@kazupon kazupon added bug 🐛 pending triage v8 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage config and removed pending triage bug 🐛 labels May 22, 2023 — with Volta.net
Copy link
Collaborator

kazupon commented May 22, 2023

simillar issue #1909

I found out reproduction pattern.

This issue seems to occur when the module in nuxt.config.ts is configured as an array.
It works correctly when the nuxt i18n module is configured in the commonly used object format.

import i18nConfig from './nuxt.i18n.config';

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
  // NOTE: not work
  // modules: [['@nuxtjs/i18n', i18nConfig]],

  // NOTE: work correctly
  modules: ['@nuxtjs/i18n'],
  i18n: i18nConfig
});

@gbyesiltas
Copy link
Author

simillar issue #1909

I found out reproduction pattern.

This issue seems to occur when the module in nuxt.config.ts is configured as an array. It works correctly when the nuxt i18n module is configured in the commonly used object format.

import i18nConfig from './nuxt.i18n.config';

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
  // NOTE: not work
  // modules: [['@nuxtjs/i18n', i18nConfig]],

  // NOTE: work correctly
  modules: ['@nuxtjs/i18n'],
  i18n: i18nConfig
});

Yep, this fixes the issue indeed. Thanks! :)

@kazupon kazupon changed the title i18n-t tag and pluralisation don't work on production build when use array type module configuraion, i18n-t tag and pluralisation don't work on production build Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config help wanted 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage PR Welcome v8
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants