Localized routes support for no-prefix, custom domain and nuxt generate
Is your feature request related to a problem? Please describe.
I am using nuxt in static mode with nuxt generate and I am generating static html pages per languague for custom domains. I want to localize the paths too, but when I try to do it, I have always both translated paths in all my pages per locale but with text for generated locale. Currently I used the prefix url mode.
Snippets from config I am using to do it:
i18n configuration
import { locale, locales, localeBaseUrl } from './locale.config'
export default {
// Translations
i18n: {
locales,
langDir: '@/i18n/',
differentDomains: process.env.NODE_ENV === 'production',
defaultLocale: locale, // <-- this is crawled from env because I want generate separated html files per locale
detectBrowserLanguage: false,
vueI18n: {
locale,
fallbackLocale: locale,
}
},
}
Locale settings
export const defaultLocale = 'en';
export const locale = process.env.LOCALE || defaultLocale; // <- used for defaultLocale in i18n settings to generate html site per locale with custom domain
export const locales = [
{
code: 'en',
name: 'English', iso: 'en-GB',
domain: process.env.BASE_URL || 'https://timepress.co.uk',
file: 'en.json'
},
{
code: 'cs',
name: 'Česky',
iso: 'cs-CZ',
domain: process.env.BASE_URL || 'https://timepress.cz',
file: 'cs.json'
}
]
export const localeBaseUrl = locales.find((l) => l.code === locale)?.domain
Nuxt generate configuration
target: 'static',
/* ... */
generate: {
fallback: '404.html',
dir: process.env.LOCALE ? `dist/${process.env.LOCALE}` : 'dist' // <- generate site per locale for every custom domain
},
And the result I got:

The site for cs has always czech texts for both en and cs url paths and site for en too, but with english texts.
Describe the solution you'd like
If I set target: 'static' with nuxt generate and custom domains and set i18n module to no-prefix mode, I get per-locale sites with coresponding paths only for generate site's locale eg. for czech site only the czech urls and for english site only the english urls.
Describe alternatives you've considered
Another implementation anc configuration for static target, nuxt generate and custom domains but I get for czech site only the czech urls and for english site only the english urls.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.