nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.65k stars 465 forks source link

Can not use custom path with i18n in nuxt.config.ts #2959

Closed gaomingzhao666 closed 1 month ago

gaomingzhao666 commented 1 month ago

Environment

main dependencies is following

{
  "@nuxt/ui": "^2.16.0",
  "nuxt": "^3.11.2",
  "@nuxtjs/i18n": "^8.3.1",
}

Reproduction

Reproduction is here

Describe the bug

I can not use custom path with a specific folder path, it is work properly when using a default path, but when I set custom path as /internationalization/i18n.config.ts as my config file path, that config file is not import properly.

Logs

[intlify] not found 'name' key in 'en' locale messages nuxt-i18n
BobbieGoede commented 1 month ago

You haven't configured a langDir so the module is unable to find the file configured for each entry in locales, adding langDir: './internationalization/lang' to the i18n config in nuxt.config.ts should resolve your issue.

We should probably check if file or files is configured without a langDir so we can provide a better error message.

Let me know if you have any questions, if the suggested changes solve your problem we can close this issue!

gaomingzhao666 commented 1 month ago

@BobbieGoede Thank you so much for your help, the problem is well-solved!!