forked from nuxt-modules/i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.d.ts
82 lines (70 loc) · 1.92 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
import Vue from 'vue'
import 'vuex'
import 'vue-i18n'
import '@nuxt/types'
import { Location, RawLocation, Route } from 'vue-router'
import { MetaInfo } from 'vue-meta'
import { Options, NuxtI18nInstance, IVueI18nNuxt } from '.'
interface NuxtI18nComponentOptions {
paths?: {
[key: string]: string | false
}
locales?: Array<string>
}
interface NuxtI18nHeadOptions {
/**
* Adds a `dir` attribute to the HTML element.
* @default false
*/
addDirAttribute?: boolean
/**
* Adds various SEO attributes.
* @default false
*/
addSeoAttributes?: boolean | SeoAttributesOptions
}
interface SeoAttributesOptions {
/**
* An array of strings corresponding to query params you would like to include in your canonical URL.
* @default []
*/
canonicalQueries?: string[]
}
type NuxtI18nMeta = Required<Pick<MetaInfo, 'htmlAttrs' | 'link' | 'meta'>>
interface NuxtI18nApi {
getRouteBaseName(route?: Route): string | undefined
localePath(route: RawLocation, locale?: string): string
localeRoute(route: RawLocation, locale?: string): Route | undefined
localeLocation(route: RawLocation, locale?: string): Location | undefined
switchLocalePath(locale: string): string
}
declare module 'vue-i18n' {
interface IVueI18n extends IVueI18nNuxt {}
}
declare module 'vue/types/vue' {
interface Vue extends NuxtI18nApi {
// $i18n is already added by vue-i18n.
$nuxtI18nHead(options?: NuxtI18nHeadOptions): NuxtI18nMeta
}
}
declare module 'vue/types/options' {
interface ComponentOptions<V extends Vue> {
nuxtI18n?: NuxtI18nComponentOptions | false
}
}
declare module '@nuxt/types' {
interface Context extends NuxtI18nApi {
i18n: NuxtI18nInstance
}
interface NuxtAppOptions extends NuxtI18nApi {
i18n: NuxtI18nInstance
}
interface NuxtConfig {
i18n?: Options
}
}
declare module 'vuex/types/index' {
interface Store<S> extends NuxtI18nApi {
$i18n: NuxtI18nInstance
}
}