forked from nuxt-modules/i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.ts
80 lines (77 loc) · 1.83 KB
/
nuxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { defineNuxtConfig } from 'nuxt'
// @ts-ignore
import I18nModule from '../dist/module.mjs'
// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
modules: [I18nModule],
vite: {
build: {
minify: false
}
},
i18n: {
langDir: 'locales',
lazy: true,
baseUrl: 'http://localhost:3000',
locales: [
{
code: 'en',
iso: 'en-US',
file: 'en.json',
domain: 'localhost:3000',
name: 'English'
},
{
code: 'ja',
iso: 'ja-JP',
file: 'ja.json',
domain: 'github.com',
name: 'Japanses'
},
{
code: 'fr',
iso: 'fr-FR',
file: 'fr.json',
domain: 'google.com',
name: 'Français'
}
],
// trailingSlash: true,
debug: true,
defaultLocale: 'en',
// strategy: 'no_prefix',
// strategy: 'prefix',
// strategy: 'prefix_and_default',
parsePages: false,
pages: {
about: {
ja: false
}
},
// differentDomains: true,
detectBrowserLanguage: false,
// detectBrowserLanguage: {
// // alwaysRedirect: true,
// useCookie: false
// // cookieKey: 'i18n_redirected',
// // cookieKey: 'my_custom_cookie_name',
// // redirectOn: 'root'
// },
onBeforeLanguageSwitch: (oldLocale, newLocale, initial, context) => {
console.log('onBeforeLanguageSwitch', oldLocale, newLocale, initial)
},
onLanguageSwitched: (oldLocale, newLocale) => {
console.log('onLanguageSwitched', oldLocale, newLocale)
},
vueI18n: {
legacy: false,
locale: 'en'
// fallbackLocale: 'en',
// fallbackLocale: {
// en: ['ja', 'fr', 'en-US'],
// ja: ['en', 'fr', 'ja-JP'],
// fr: ['en', 'ja', 'fr-FR']
// }
}
}
})