forked from nuxt-modules/i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt-i18n.d.ts
99 lines (90 loc) · 2.8 KB
/
nuxt-i18n.d.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import VueI18n from 'vue-i18n'
import { MetaInfo } from 'vue-meta'
import { Context as NuxtContext } from '@nuxt/types'
/**
* The nuxt-i18n types namespace
*/
declare namespace NuxtVueI18n {
type Locale = VueI18n.Locale
type Strategies = 'no_prefix' | 'prefix_except_default' | 'prefix' | 'prefix_and_default'
namespace Options {
// e.g.:
// [
// { code: 'en', iso: 'en-US', file: 'en.js' },
// { code: 'fr', iso: 'fr-FR', file: 'fr.js' },
// { code: 'es', iso: 'es-ES', file: 'es.js' }
// ]
interface LocaleObject {
code: Locale
// can be undefined: https://goo.gl/cCGKUV
iso?: string
// can be undefined: https://goo.gl/ryc5pF
file?: string
isCatchallLocale?: boolean
// Allow custom properties, e.g. "name": https://goo.gl/wrcb2G
[key: string]: any
}
interface DetectBrowserLanguageInterface {
useCookie?: boolean
crossOriginCookie?: boolean
cookieDomain?: string | null
cookieKey?: string
alwaysRedirect?: boolean
fallbackLocale?: Locale | null
onlyOnRoot?: boolean
}
interface RootRedirectInterface {
path: string
statusCode: number
}
interface VuexInterface {
moduleName?: string
syncLocale?: boolean
syncMessages?: boolean
syncRouteParams?: boolean
}
// options that are also exposed on VueI18n instance: https://goo.gl/UwNfZo
interface NuxtI18nInterface {
beforeLanguageSwitch?: (oldLocale: string, newLocale: string) => void
defaultLocale?: Locale
defaultLocaleRouteNameSuffix?: string
locales?: Array<Locale | LocaleObject>
differentDomains?: boolean
forwardedHost?: boolean
onLanguageSwitched?: (oldLocale: string, newLocale: string) => void
}
// see options reference: https://github.com/nuxt-community/i18n-module/blob/master/docs/options-reference.md
interface AllOptionsInterface extends NuxtI18nInterface {
baseUrl?: string | ((context: NuxtContext) => string)
detectBrowserLanguage?: DetectBrowserLanguageInterface | false
langDir?: string | null
lazy?: boolean
// see https://goo.gl/NbzX3f
pages?: {
[key: string]: boolean | {
[key: string]: boolean | string
}
}
parsePages?: boolean
rootRedirect?: string | null | RootRedirectInterface
routesNameSeparator?: string
seo?: boolean
strategy?: Strategies
vueI18n?: VueI18n.I18nOptions | string
vueI18nLoader?: boolean
vuex?: VuexInterface | false
}
}
}
export interface NuxtI18nSeo {
htmlAttrs?: MetaInfo['htmlAttrs']
link?: MetaInfo['link']
meta?: MetaInfo['meta']
}
export interface NuxtI18nComponentOptions {
paths?: {
[key: string]: string | false
}
locales?: Array<string>
seo?: false
}