i18n icon indicating copy to clipboard operation
i18n copied to clipboard

index file not in language subfolder after nuxt generate

Open martinval opened this issue 2 years ago • 1 comments

Apologies if this has already been asked, I scanned closed issues but didn't see anything. Using nuxt-i18n 6.11.1 I generate a static site with the following setting:

i18n: {
       locales: ['fr', 'en'],
       defaultLocale: 'en',
       noPrefixDefaultLocale: true,
  },

This creates all my FR paths in a subfolder /fr, but for the index page, it creates a page called fr.html in the main folder. The issue I'm having is that on a page reload of the www.mysite.com/fr route, it looks for an index file in the /fr subfolder and can't find one. I solved this by manually copying the fr.html into the /fr folder and renaming it index.html, but I'd like to avoid having to do this hack every time I redeploy the site.

Is there a way around this ? Thanks for any pointers.

martinval avatar Mar 21 '22 16:03 martinval

(There is no option called noPrefixDefaultLocale since v3 of the module.)

Whether visiting /fr picks up fr.html or /fr/index.html is dependent on your hosting so you should look there for a way to configure it.

Alternatively you could try to change this Nuxt option: https://nuxtjs.org/docs/configuration-glossary/configuration-generate#subfolders though I would probably recommend handling this on the hosting side.

rchl avatar Mar 22 '22 11:03 rchl