@friendlyinternet/nuxt-crouton-i18n
Version:
i18n layer extending nuxt-crouton for multi-language support
45 lines (38 loc) • 1.1 kB
text/typescript
import { fileURLToPath } from 'node:url'
import { join } from 'node:path'
const currentDir = fileURLToPath(new URL('.', import.meta.url))
export default defineNuxtConfig({
$meta: {
name: 'nuxt-crouton-i18n',
description: 'i18n addon layer for FYIT collections'
},
// Note: This is an addon layer - users must explicitly extend both:
// extends: ['@friendlyinternet/nuxt-crouton', '@friendlyinternet/nuxt-crouton-i18n']
// Add i18n module
modules: ['@nuxtjs/i18n'],
// i18n configuration
i18n: {
locales: [
{ code: 'en', name: 'English', file: 'en.json' },
{ code: 'nl', name: 'Nederlands', file: 'nl.json' },
{ code: 'fr', name: 'Français', file: 'fr.json' }
],
langDir: '../locales', // Relative to srcDir (app/)
defaultLocale: 'en',
strategy: 'no_prefix'
},
// Component configuration
components: {
dirs: [
{
path: join(currentDir, 'app/components'),
prefix: 'CroutonI18n',
global: true
}
]
},
// Composables
imports: {
dirs: [join(currentDir, 'app/composables')]
}
})