forked from nuxt-modules/i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.d.ts
119 lines (110 loc) · 3.06 KB
/
vue.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import Vue from "vue";
import { RawLocation } from "vue-router";
import VueI18n, { IVueI18n } from "vue-i18n";
/**
* The nuxt-i18n types namespace
*/
declare namespace NuxtVueI18n {
type Locale = VueI18n.Locale
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
// Allow custom properties, e.g. "name": https://goo.gl/wrcb2G
[key: string]: any
}
interface DetectBrowserLanguageInterface {
useCookie: boolean
cookieKey: string
alwaysRedirect: boolean
fallbackLocale: Locale | null
}
interface Vuex {
moduleName: string
mutations: {
setLocale: string
setMessages: string
}
preserveState: boolean
}
// special options for a "app.i18n" property: https://goo.gl/UwNfZo
interface VueI18nInterface {
locales: Array<Locale | LocaleObject>
defaultLocale: null | Locale
differentDomains: boolean
forwardedHost: boolean
routesNameSeparator: string
beforeLanguageSwitch: () => any
onLanguageSwitched: () => any
setLocaleCookie: (locale: string) => undefined
}
// see options reference: https://github.com/nuxt-community/nuxt-i18n/blob/master/docs/options-reference.md
interface AllOptionsInterface extends VueI18nInterface {
vueI18n: VueI18n.I18nOptions
strategy: "prefix_except_default" | "prefix" | "prefix_and_default"
lazy: boolean
langDir: string | null
rootRedirect: string | null
detectBrowserLanguage: Options.DetectBrowserLanguageInterface
seo: false
baseUrl: string
vuex: Options.Vuex
parsePages: boolean
// see https://goo.gl/NbzX3f
pages: {
[key: string]: boolean | {
[key: string]: boolean | string
}
}
encodePaths: boolean
}
}
}
/**
* Extends types in vue
*/
declare module "vue/types/vue" {
interface NuxtI18nSeo {
htmlAttrs?: {
lang?: string
}
link?: {
hid: string,
rel: string,
href: string,
hreflang: string
}[]
meta?: {
hid: string,
name: string,
property: string,
content: string
}[]
}
interface Vue {
localePath(route: RawLocation, locale?: string): string;
switchLocalePath(locale: string): string;
getRouteBaseName(route: RawLocation): string;
$nuxtI18nSeo(): NuxtI18nSeo;
// PHPStorm without this indicates that "$i18n" was not found.
readonly $i18n: VueI18n & IVueI18n;
}
}
/**
* Extends types in vue-i18n
*/
declare module "vue-i18n" {
// the VueI18n class expands here: https://goo.gl/Xtp9EG
// it is necessary for the $i18n property in Vue interface: "readonly $i18n: VueI18n & IVueI18n"
interface IVueI18n extends NuxtVueI18n.Options.VueI18nInterface {
}
}