@@ -20,23 +20,28 @@ import { defineMixin } from './mixin'
2020import { isEmptyObject } from './utils'
2121
2222/**
23- * I18n Options
23+ * I18n Options for `createI18n`
2424 *
2525 * @remarks
26- * `I18nOptions` is inherited {@link ComposerOptions} and {@link VueI18nOptions}, so you can specify these options.
26+ * `I18nOptions` is inherited {@link I18nAdditionalOptions}, {@link ComposerOptions} and {@link VueI18nOptions},
27+ * so you can specify these options.
2728 *
2829 */
30+ export type I18nOptions = I18nAdditionalOptions &
31+ ( ComposerOptions | VueI18nOptions )
32+
33+ /**
34+ * I18n Additional Options for `createI18n`
35+ */
2936export interface I18nAdditionalOptions {
3037 /**
3138 * Whether vue-i18n legacy API use on your Vue App.
39+ *
3240 * @defaultValue `false`
3341 */
3442 legacy ?: boolean
3543}
3644
37- export type I18nOptions = I18nAdditionalOptions &
38- ( ComposerOptions | VueI18nOptions )
39-
4045/**
4146 * I18n API mode
4247 */
@@ -46,16 +51,32 @@ export type I18nMode = 'legacy' | 'composable'
4651 * I18n interface
4752 */
4853export interface I18n {
54+ /**
55+ * I18n API mode
56+ *
57+ * @remarks
58+ * if you specified `legacy: true` option in `createI18n`, return `legacy`,
59+ * else `composable`
60+ *
61+ * @defaultValue `composable`
62+ */
4963 readonly mode : I18nMode
64+ /**
65+ * Global composer
66+ */
67+ readonly global : Composer
68+ /**
69+ * @internal
70+ */
5071 install ( app : App , ...options : unknown [ ] ) : void
5172}
5273
5374/**
5475 * I18n interface for internal usage
76+ *
5577 * @internal
5678 */
5779export interface I18nInternal {
58- readonly _global : Composer
5980 _getComposer ( instance : ComponentInternalInstance ) : Composer | null
6081 _setComposer ( instance : ComponentInternalInstance , composer : Composer ) : void
6182 _deleteComposer ( instance : ComponentInternalInstance ) : void
@@ -70,17 +91,24 @@ export interface I18nInternal {
7091export type I18nScope = 'local' | 'parent' | 'global'
7192
7293/**
73- * Composer additional options
94+ * I18n Options for `useI18n`
95+ *
96+ * @remarks
97+ * `UseI18nOptions` is inherited {@link ComposerAdditionalOptions} and {@link ComposerOptions},
98+ * so you can specify these options.
99+ */
100+ export type UseI18nOptions = ComposerAdditionalOptions & ComposerOptions
101+
102+ /**
103+ * Composer additional options for `useI18n`
74104 *
75- * @remarks
105+ * @remarks
76106 * `ComposerAdditionalOptions` is extend for {@link ComposerOptions}, so you can specify these options.
77107 */
78108export interface ComposerAdditionalOptions {
79- useScope ?: I18nScope // default 'global'
109+ useScope ?: I18nScope
80110}
81111
82- export type UseI18nOptions = ComposerAdditionalOptions & ComposerOptions
83-
84112/**
85113 * I18n instance injectin key
86114 * @internal
@@ -97,7 +125,7 @@ export const I18nSymbol: InjectionKey<I18n & I18nInternal> = Symbol.for(
97125 *
98126 * @remarks
99127 * When you use Composable API, you need to specify options of {@link ComposerOptions}.
100- * When you use Legacy API, you need toto specify options of {@link VueI18nOptions} and `legacy: true`.
128+ * When you use Legacy API, you need toto specify options of {@link VueI18nOptions} and `legacy: true` option .
101129 *
102130 * @example
103131 * case: for Composable API
@@ -181,7 +209,7 @@ export function createI18n(options: I18nOptions = {}): I18n {
181209 )
182210 }
183211 } ,
184- get _global ( ) : Composer {
212+ get global ( ) : Composer {
185213 return __legacyMode
186214 ? ( __global as VueI18n ) . __composer
187215 : ( __global as Composer )
@@ -264,7 +292,7 @@ export function useI18n(options: UseI18nOptions = {}): Composer {
264292 throw new Error ( 'TODO' )
265293 }
266294
267- const global = i18n . _global
295+ const global = i18n . global
268296
269297 let emptyOption = false
270298 // prettier-ignore
0 commit comments