@i18n-micro/vue 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/i18n-group.d.ts +6 -24
- package/dist/components/i18n-link.d.ts +29 -5
- package/dist/components/i18n-switcher.d.ts +58 -0
- package/dist/components/i18n-t.d.ts +1 -1
- package/dist/composer.d.ts +10 -17
- package/dist/index.cjs +1 -68
- package/dist/index.d.ts +4 -6
- package/dist/index.mjs +433 -12240
- package/dist/injection.d.ts +2 -0
- package/dist/plugin.d.ts +18 -1
- package/dist/router/adapter.d.ts +9 -0
- package/dist/router/types.d.ts +43 -0
- package/dist/use-i18n.d.ts +28 -22
- package/package.json +18 -13
- package/dist/devtools/bridge/vue-bridge.d.ts +0 -14
- package/dist/devtools/index.d.ts +0 -9
- package/dist/router.d.ts +0 -27
|
@@ -1,24 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
groupClass: {
|
|
8
|
-
type: PropType<string>;
|
|
9
|
-
default: string;
|
|
10
|
-
};
|
|
11
|
-
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
14
|
-
prefix: {
|
|
15
|
-
type: PropType<string>;
|
|
16
|
-
required: true;
|
|
17
|
-
};
|
|
18
|
-
groupClass: {
|
|
19
|
-
type: PropType<string>;
|
|
20
|
-
default: string;
|
|
21
|
-
};
|
|
22
|
-
}>> & Readonly<{}>, {
|
|
23
|
-
groupClass: string;
|
|
24
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
1
|
+
interface I18nGroupProps {
|
|
2
|
+
prefix: string;
|
|
3
|
+
groupClass?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const I18nGroup: import('vue').DefineComponent<I18nGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<I18nGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
export {};
|
|
@@ -1,25 +1,49 @@
|
|
|
1
|
-
import { PropType, CSSProperties
|
|
2
|
-
|
|
3
|
-
export declare const I18nLink: DefineComponent<import('vue').ExtractPropTypes<{
|
|
1
|
+
import { PropType, CSSProperties } from 'vue';
|
|
2
|
+
export declare const I18nLink: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
3
|
to: {
|
|
5
|
-
type: PropType<
|
|
4
|
+
type: PropType<string | {
|
|
5
|
+
path?: string;
|
|
6
|
+
}>;
|
|
6
7
|
required: true;
|
|
7
8
|
};
|
|
8
9
|
activeStyle: {
|
|
9
10
|
type: PropType<CSSProperties>;
|
|
10
11
|
default: () => {};
|
|
11
12
|
};
|
|
13
|
+
localeRoute: {
|
|
14
|
+
type: PropType<(to: string | {
|
|
15
|
+
path?: string;
|
|
16
|
+
}, locale?: string) => string | {
|
|
17
|
+
path?: string;
|
|
18
|
+
}>;
|
|
19
|
+
default: undefined;
|
|
20
|
+
};
|
|
12
21
|
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
13
22
|
[key: string]: any;
|
|
14
23
|
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
15
24
|
to: {
|
|
16
|
-
type: PropType<
|
|
25
|
+
type: PropType<string | {
|
|
26
|
+
path?: string;
|
|
27
|
+
}>;
|
|
17
28
|
required: true;
|
|
18
29
|
};
|
|
19
30
|
activeStyle: {
|
|
20
31
|
type: PropType<CSSProperties>;
|
|
21
32
|
default: () => {};
|
|
22
33
|
};
|
|
34
|
+
localeRoute: {
|
|
35
|
+
type: PropType<(to: string | {
|
|
36
|
+
path?: string;
|
|
37
|
+
}, locale?: string) => string | {
|
|
38
|
+
path?: string;
|
|
39
|
+
}>;
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
23
42
|
}>> & Readonly<{}>, {
|
|
24
43
|
activeStyle: CSSProperties;
|
|
44
|
+
localeRoute: (to: string | {
|
|
45
|
+
path?: string;
|
|
46
|
+
}, locale?: string) => string | {
|
|
47
|
+
path?: string;
|
|
48
|
+
};
|
|
25
49
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropType, CSSProperties, VNode } from 'vue';
|
|
2
|
+
import { Locale } from '@i18n-micro/types';
|
|
2
3
|
export declare const I18nSwitcher: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
3
4
|
customLabels: {
|
|
4
5
|
type: PropType<Record<string, string>>;
|
|
@@ -36,6 +37,30 @@ export declare const I18nSwitcher: import('vue').DefineComponent<import('vue').E
|
|
|
36
37
|
type: PropType<CSSProperties>;
|
|
37
38
|
default: () => {};
|
|
38
39
|
};
|
|
40
|
+
locales: {
|
|
41
|
+
type: PropType<Locale[]>;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
currentLocale: {
|
|
45
|
+
type: PropType<string | (() => string)>;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
getLocaleName: {
|
|
49
|
+
type: PropType<() => string | null>;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
switchLocale: {
|
|
53
|
+
type: PropType<(locale: string) => void>;
|
|
54
|
+
default: undefined;
|
|
55
|
+
};
|
|
56
|
+
localeRoute: {
|
|
57
|
+
type: PropType<(to: string | {
|
|
58
|
+
path?: string;
|
|
59
|
+
}, locale?: string) => string | {
|
|
60
|
+
path?: string;
|
|
61
|
+
}>;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
39
64
|
}>, () => VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
40
65
|
[key: string]: any;
|
|
41
66
|
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
@@ -75,7 +100,36 @@ export declare const I18nSwitcher: import('vue').DefineComponent<import('vue').E
|
|
|
75
100
|
type: PropType<CSSProperties>;
|
|
76
101
|
default: () => {};
|
|
77
102
|
};
|
|
103
|
+
locales: {
|
|
104
|
+
type: PropType<Locale[]>;
|
|
105
|
+
default: undefined;
|
|
106
|
+
};
|
|
107
|
+
currentLocale: {
|
|
108
|
+
type: PropType<string | (() => string)>;
|
|
109
|
+
default: undefined;
|
|
110
|
+
};
|
|
111
|
+
getLocaleName: {
|
|
112
|
+
type: PropType<() => string | null>;
|
|
113
|
+
default: undefined;
|
|
114
|
+
};
|
|
115
|
+
switchLocale: {
|
|
116
|
+
type: PropType<(locale: string) => void>;
|
|
117
|
+
default: undefined;
|
|
118
|
+
};
|
|
119
|
+
localeRoute: {
|
|
120
|
+
type: PropType<(to: string | {
|
|
121
|
+
path?: string;
|
|
122
|
+
}, locale?: string) => string | {
|
|
123
|
+
path?: string;
|
|
124
|
+
}>;
|
|
125
|
+
default: undefined;
|
|
126
|
+
};
|
|
78
127
|
}>> & Readonly<{}>, {
|
|
128
|
+
localeRoute: (to: string | {
|
|
129
|
+
path?: string;
|
|
130
|
+
}, locale?: string) => string | {
|
|
131
|
+
path?: string;
|
|
132
|
+
};
|
|
79
133
|
customLabels: Record<string, string>;
|
|
80
134
|
customWrapperStyle: CSSProperties;
|
|
81
135
|
customButtonStyle: CSSProperties;
|
|
@@ -85,4 +139,8 @@ export declare const I18nSwitcher: import('vue').DefineComponent<import('vue').E
|
|
|
85
139
|
customActiveLinkStyle: CSSProperties;
|
|
86
140
|
customDisabledLinkStyle: CSSProperties;
|
|
87
141
|
customIconStyle: CSSProperties;
|
|
142
|
+
locales: Locale[];
|
|
143
|
+
currentLocale: string | (() => string);
|
|
144
|
+
getLocaleName: () => string | null;
|
|
145
|
+
switchLocale: (locale: string) => void;
|
|
88
146
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -85,8 +85,8 @@ export declare const I18nT: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
85
85
|
type: PropType<Date | string | number>;
|
|
86
86
|
};
|
|
87
87
|
}>> & Readonly<{}>, {
|
|
88
|
-
params: Record<string, string | number | boolean>;
|
|
89
88
|
tag: string;
|
|
89
|
+
params: Record<string, string | number | boolean>;
|
|
90
90
|
defaultValue: string;
|
|
91
91
|
html: boolean;
|
|
92
92
|
hideIfEmpty: boolean;
|
package/dist/composer.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
import { Translations,
|
|
2
|
+
import { BaseI18n, TranslationStorage } from '@i18n-micro/core';
|
|
3
|
+
import { Translations, PluralFunc } from '@i18n-micro/types';
|
|
4
4
|
export interface VueI18nOptions {
|
|
5
5
|
locale: string;
|
|
6
6
|
fallbackLocale?: string;
|
|
@@ -9,16 +9,12 @@ export interface VueI18nOptions {
|
|
|
9
9
|
missingWarn?: boolean;
|
|
10
10
|
missingHandler?: (locale: string, key: string, routeName: string) => void;
|
|
11
11
|
}
|
|
12
|
-
export declare class VueI18n {
|
|
12
|
+
export declare class VueI18n extends BaseI18n {
|
|
13
13
|
private _locale;
|
|
14
14
|
private _fallbackLocale;
|
|
15
15
|
private _currentRoute;
|
|
16
|
-
private
|
|
17
|
-
|
|
18
|
-
private pluralFunc;
|
|
19
|
-
private missingWarn;
|
|
20
|
-
private missingHandler?;
|
|
21
|
-
readonly cache: TranslationCache;
|
|
16
|
+
private _revision;
|
|
17
|
+
readonly storage: TranslationStorage;
|
|
22
18
|
private listeners;
|
|
23
19
|
constructor(options: VueI18nOptions);
|
|
24
20
|
get locale(): Ref<string>;
|
|
@@ -27,14 +23,9 @@ export declare class VueI18n {
|
|
|
27
23
|
set fallbackLocale(val: Ref<string> | string);
|
|
28
24
|
get currentRoute(): Ref<string>;
|
|
29
25
|
setRoute(routeName: string): void;
|
|
26
|
+
getLocale(): string;
|
|
27
|
+
getFallbackLocale(): string;
|
|
30
28
|
getRoute(): string;
|
|
31
|
-
t(key: TranslationKey, params?: Params, defaultValue?: string | null, routeName?: string): CleanTranslation;
|
|
32
|
-
ts(key: TranslationKey, params?: Params, defaultValue?: string, routeName?: string): string;
|
|
33
|
-
tc(key: TranslationKey, count: number | Params, defaultValue?: string): string;
|
|
34
|
-
tn(value: number, options?: Intl.NumberFormatOptions): string;
|
|
35
|
-
td(value: Date | number | string, options?: Intl.DateTimeFormatOptions): string;
|
|
36
|
-
tdr(value: Date | number | string, options?: Intl.RelativeTimeFormatOptions): string;
|
|
37
|
-
has(key: TranslationKey, _routeName?: string): boolean;
|
|
38
29
|
addTranslations(locale: string, translations: Translations, merge?: boolean): void;
|
|
39
30
|
addRouteTranslations(locale: string, routeName: string, translations: Translations, merge?: boolean): void;
|
|
40
31
|
mergeTranslations(locale: string, routeName: string, translations: Translations): void;
|
|
@@ -43,5 +34,7 @@ export declare class VueI18n {
|
|
|
43
34
|
subscribeToChanges(cb: () => void): () => void;
|
|
44
35
|
private notifyListeners;
|
|
45
36
|
getAllTranslations(): Record<string, Translations>;
|
|
46
|
-
|
|
37
|
+
getStorage(): TranslationStorage;
|
|
38
|
+
getGeneralCache(): Record<string, Translations>;
|
|
39
|
+
getRouteCache(): Record<string, Translations>;
|
|
47
40
|
}
|