@intlify/vue-i18n-extensions 9.0.1 → 9.1.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/README.md +2 -4
- package/dist/index.cjs +374 -421
- package/dist/index.d.cts +39 -41
- package/dist/index.d.mts +39 -41
- package/dist/index.mjs +373 -419
- package/package.json +49 -68
- package/dist/index.d.ts +0 -131
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { I18n, I18nMode } from
|
|
3
|
-
|
|
1
|
+
import { DirectiveTransform, TransformContext } from "@vue/compiler-dom";
|
|
2
|
+
import { I18n, I18nMode, Locale } from "vue-i18n";
|
|
4
3
|
/**
|
|
5
4
|
* Translation signature resolver
|
|
6
5
|
*
|
|
@@ -42,38 +41,38 @@ type TranslationSignatureResolver = (context: TransformContext, baseResolver: (c
|
|
|
42
41
|
*
|
|
43
42
|
* @public
|
|
44
43
|
*/
|
|
45
|
-
interface TransformVTDirectiveOptions<Messages extends Record<string, unknown> = {}, //
|
|
46
|
-
DateTimeFormats extends Record<string, unknown> = {}, //
|
|
47
|
-
NumberFormats extends Record<string, unknown> = {}, //
|
|
48
|
-
Legacy extends boolean = true> {
|
|
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
|
-
|
|
44
|
+
interface TransformVTDirectiveOptions<Messages extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
45
|
+
DateTimeFormats extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
46
|
+
NumberFormats extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
47
|
+
Legacy extends boolean = true, OptionLocale = Locale> {
|
|
48
|
+
/**
|
|
49
|
+
* I18n instance
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* If this option is specified, `v-t` custom directive transform uses an I18n instance to pre-translate.
|
|
53
|
+
* The translation will use the global resources registered in the I18n instance,
|
|
54
|
+
* that is, `v-t` directive transform is also a limitation that the resources of each component cannot be used.
|
|
55
|
+
*/
|
|
56
|
+
i18n?: I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, Legacy>;
|
|
57
|
+
/**
|
|
58
|
+
* I18n Mode
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* Specify the API style of vue-i18n. If you use legacy API style (e.g. `$t`) at vue-i18n, you need to specify `legacy`.
|
|
62
|
+
*
|
|
63
|
+
* @default 'composition'
|
|
64
|
+
*/
|
|
65
|
+
mode?: I18nMode;
|
|
66
|
+
/**
|
|
67
|
+
* Translation function signatures
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* You can specify the signature of the translation function attached to the binding context when it is codegen in the Vue Compiler.
|
|
71
|
+
* If you have changed the signature to a non `t` signature in the `setup` hook or `<script setup>`, you can safely SSR it.
|
|
72
|
+
* If each Vue component has a different signature for the translation function, you can specify several in an array for safe SSR.
|
|
73
|
+
* This option value is `undefined` and the signature attached to the binding context is `t`.
|
|
74
|
+
*/
|
|
75
|
+
translationSignatures?: string | TranslationSignatureResolver | string[] | TranslationSignatureResolver[] | (string | TranslationSignatureResolver)[];
|
|
77
76
|
}
|
|
78
77
|
/**
|
|
79
78
|
* Transform `v-t` custom directive
|
|
@@ -123,9 +122,8 @@ Legacy extends boolean = true> {
|
|
|
123
122
|
* ```
|
|
124
123
|
* @public
|
|
125
124
|
*/
|
|
126
|
-
declare function transformVTDirective<Messages extends Record<string, unknown> = {}, //
|
|
127
|
-
DateTimeFormats extends Record<string, unknown> = {}, //
|
|
128
|
-
NumberFormats extends Record<string, unknown> = {}, //
|
|
129
|
-
Legacy extends boolean = true>(options?: TransformVTDirectiveOptions<Messages, DateTimeFormats, NumberFormats, Legacy>): DirectiveTransform;
|
|
130
|
-
|
|
131
|
-
export { type TransformVTDirectiveOptions, type TranslationSignatureResolver, transformVTDirective };
|
|
125
|
+
export declare function transformVTDirective<Messages extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
126
|
+
DateTimeFormats extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
127
|
+
NumberFormats extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
128
|
+
Legacy extends boolean = true, OptionLocale = Locale>(options?: TransformVTDirectiveOptions<Messages, DateTimeFormats, NumberFormats, Legacy, OptionLocale>): DirectiveTransform;
|
|
129
|
+
export type { TransformVTDirectiveOptions, TranslationSignatureResolver };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { I18n, I18nMode } from
|
|
3
|
-
|
|
1
|
+
import { DirectiveTransform, TransformContext } from "@vue/compiler-dom";
|
|
2
|
+
import { I18n, I18nMode, Locale } from "vue-i18n";
|
|
4
3
|
/**
|
|
5
4
|
* Translation signature resolver
|
|
6
5
|
*
|
|
@@ -42,38 +41,38 @@ type TranslationSignatureResolver = (context: TransformContext, baseResolver: (c
|
|
|
42
41
|
*
|
|
43
42
|
* @public
|
|
44
43
|
*/
|
|
45
|
-
interface TransformVTDirectiveOptions<Messages extends Record<string, unknown> = {}, //
|
|
46
|
-
DateTimeFormats extends Record<string, unknown> = {}, //
|
|
47
|
-
NumberFormats extends Record<string, unknown> = {}, //
|
|
48
|
-
Legacy extends boolean = true> {
|
|
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
|
-
|
|
44
|
+
interface TransformVTDirectiveOptions<Messages extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
45
|
+
DateTimeFormats extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
46
|
+
NumberFormats extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
47
|
+
Legacy extends boolean = true, OptionLocale = Locale> {
|
|
48
|
+
/**
|
|
49
|
+
* I18n instance
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* If this option is specified, `v-t` custom directive transform uses an I18n instance to pre-translate.
|
|
53
|
+
* The translation will use the global resources registered in the I18n instance,
|
|
54
|
+
* that is, `v-t` directive transform is also a limitation that the resources of each component cannot be used.
|
|
55
|
+
*/
|
|
56
|
+
i18n?: I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, Legacy>;
|
|
57
|
+
/**
|
|
58
|
+
* I18n Mode
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* Specify the API style of vue-i18n. If you use legacy API style (e.g. `$t`) at vue-i18n, you need to specify `legacy`.
|
|
62
|
+
*
|
|
63
|
+
* @default 'composition'
|
|
64
|
+
*/
|
|
65
|
+
mode?: I18nMode;
|
|
66
|
+
/**
|
|
67
|
+
* Translation function signatures
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* You can specify the signature of the translation function attached to the binding context when it is codegen in the Vue Compiler.
|
|
71
|
+
* If you have changed the signature to a non `t` signature in the `setup` hook or `<script setup>`, you can safely SSR it.
|
|
72
|
+
* If each Vue component has a different signature for the translation function, you can specify several in an array for safe SSR.
|
|
73
|
+
* This option value is `undefined` and the signature attached to the binding context is `t`.
|
|
74
|
+
*/
|
|
75
|
+
translationSignatures?: string | TranslationSignatureResolver | string[] | TranslationSignatureResolver[] | (string | TranslationSignatureResolver)[];
|
|
77
76
|
}
|
|
78
77
|
/**
|
|
79
78
|
* Transform `v-t` custom directive
|
|
@@ -123,9 +122,8 @@ Legacy extends boolean = true> {
|
|
|
123
122
|
* ```
|
|
124
123
|
* @public
|
|
125
124
|
*/
|
|
126
|
-
declare function transformVTDirective<Messages extends Record<string, unknown> = {}, //
|
|
127
|
-
DateTimeFormats extends Record<string, unknown> = {}, //
|
|
128
|
-
NumberFormats extends Record<string, unknown> = {}, //
|
|
129
|
-
Legacy extends boolean = true>(options?: TransformVTDirectiveOptions<Messages, DateTimeFormats, NumberFormats, Legacy>): DirectiveTransform;
|
|
130
|
-
|
|
131
|
-
export { type TransformVTDirectiveOptions, type TranslationSignatureResolver, transformVTDirective };
|
|
125
|
+
export declare function transformVTDirective<Messages extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
126
|
+
DateTimeFormats extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
127
|
+
NumberFormats extends Record<string, unknown> = {}, // oxlint-disable-line @typescript-eslint/no-empty-object-type -- TODO: fix this
|
|
128
|
+
Legacy extends boolean = true, OptionLocale = Locale>(options?: TransformVTDirectiveOptions<Messages, DateTimeFormats, NumberFormats, Legacy, OptionLocale>): DirectiveTransform;
|
|
129
|
+
export type { TransformVTDirectiveOptions, TranslationSignatureResolver };
|