UNPKG

163 kBTypeScriptView Raw
1import type { App } from 'vue';
2import { CompileError } from '@intlify/core-base';
3import type { ComponentInternalInstance } from 'vue';
4import type { ComputedRef } from 'vue';
5import { DateTimeOptions } from '@intlify/core-base';
6import { FallbackLocale } from '@intlify/core-base';
7import type { FallbackLocales } from '@intlify/core-base';
8import { InjectionKey } from 'vue';
9import { DateTimeFormat as IntlDateTimeFormat } from '@intlify/core-base';
10import { DateTimeFormats as IntlDateTimeFormats } from '@intlify/core-base';
11import { FormatMatcher as IntlFormatMatcher } from '@intlify/core-base';
12import { LocaleMatcher as IntlLocaleMatcher } from '@intlify/core-base';
13import { NumberFormat as IntlNumberFormat } from '@intlify/core-base';
14import { NumberFormats as IntlNumberFormats } from '@intlify/core-base';
15import { IsEmptyObject } from '@intlify/core-base';
16import { IsNever } from '@intlify/core-base';
17import { LinkedModifiers } from '@intlify/core-base';
18import { Locale } from '@intlify/core-base';
19import type { LocaleMessage } from '@intlify/core-base';
20import { LocaleMessageDictionary } from '@intlify/core-base';
21import { LocaleMessages } from '@intlify/core-base';
22import { LocaleMessageType } from '@intlify/core-base';
23import { LocaleMessageValue } from '@intlify/core-base';
24import type { LocaleParams } from '@intlify/core-base';
25import { MessageCompiler } from '@intlify/core-base';
26import { MessageCompilerContext } from '@intlify/core-base';
27import { MessageContext } from '@intlify/core-base';
28import { MessageFunction } from '@intlify/core-base';
29import { MessageFunctions } from '@intlify/core-base';
30import { MessageResolver } from '@intlify/core-base';
31import { NamedValue } from '@intlify/core-base';
32import { NumberOptions } from '@intlify/core-base';
33import type { ObjectDirective } from 'vue';
34import { Path } from '@intlify/core-base';
35import { PathValue } from '@intlify/core-base';
36import type { PickupFormatKeys } from '@intlify/core-base';
37import { PickupFormatPathKeys } from '@intlify/core-base';
38import { PickupKeys } from '@intlify/core-base';
39import type { PickupLocales } from '@intlify/core-base';
40import { PickupPaths } from '@intlify/core-base';
41import { PluralizationRule } from '@intlify/core-base';
42import type { PluralizationRules } from '@intlify/core-base';
43import { PostTranslationHandler } from '@intlify/core-base';
44import { RemovedIndexResources } from '@intlify/core-base';
45import type { RemoveIndexSignature } from '@intlify/core-base';
46import type { ResourceNode } from '@intlify/core-base';
47import type { ResourcePath } from '@intlify/core-base';
48import type { ResourceValue } from '@intlify/core-base';
49import type { SchemaParams } from '@intlify/core-base';
50import { TranslateOptions } from '@intlify/core-base';
51import type { VNode } from 'vue';
52import type { VNodeProps } from 'vue';
53import type { WritableComputedRef } from 'vue';
54
55/**
56 * BaseFormat Props for Components that is offered Vue I18n
57 *
58 * @remarks
59 * The interface definitions of the underlying props of components such as Translation, DatetimeFormat, and NumberFormat.
60 *
61 * @VueI18nComponent
62 */
63export declare interface BaseFormatProps {
64 /**
65 * @remarks
66 * Used to wrap the content that is distribute in the slot. If omitted, the slot content is treated as Fragments.
67 *
68 * You can specify a string-based tag name, such as `p`, or the object for which the component is defined.
69 */
70 tag?: string | object;
71 /**
72 * @remarks
73 * Specifies the locale to be used for the component.
74 *
75 * If specified, the global scope or the locale of the parent scope of the target component will not be overridden and the specified locale will be used.
76 */
77 locale?: Locale;
78 /**
79 * @remarks
80 * Specifies the scope to be used in the target component.
81 *
82 * You can specify either `global` or `parent`.
83 *
84 * If `global` is specified, global scope is used, else then `parent` is specified, the scope of the parent of the target component is used.
85 *
86 * If the parent is a global scope, the global scope is used, if it's a local scope, the local scope is used.
87 */
88 scope?: ComponentI18nScope;
89 /**
90 * @remarks
91 * A composer instance with an existing scope.
92 *
93 * This option takes precedence over the `scope` option.
94 */
95 i18n?: Composer;
96}
97
98/**
99 * Cast to VueI18n legacy compatible type
100 *
101 * @remarks
102 * This API is provided only with [vue-i18n-bridge](https://vue-i18n.intlify.dev/guide/migration/ways.html#what-is-vue-i18n-bridge).
103 *
104 * The purpose of this function is to convert an {@link I18n} instance created with {@link createI18n | createI18n(legacy: true)} into a `vue-i18n@v8.x` compatible instance of `new VueI18n` in a TypeScript environment.
105 *
106 * @param i18n - An instance of {@link I18n}
107 * @returns A i18n instance which is casted to {@link VueI18n} type
108 *
109 * @VueI18nTip
110 * :new: provided by **vue-i18n-bridge only**
111 *
112 * @VueI18nGeneral
113 */
114export declare const castToVueI18n: (i18n: I18n) => VueI18n<{}, {}, {}, string, never, string, Composer<{}, {}, {}, string, never, string>> & {
115 install: (Vue: any, options?: any) => void;
116};
117
118export declare type Choice = number;
119export { CompileError }
120
121export declare type ComponentI18nScope = Exclude<I18nScope, 'local'>;
122
123/**
124 * Composer interfaces
125 *
126 * @remarks
127 * This is the interface for being used for Vue 3 Composition API.
128 *
129 * @VueI18nComposition
130 */
131export declare interface Composer<Messages extends Record<string, any> = {}, DateTimeFormats extends Record<string, any> = {}, NumberFormats extends Record<string, any> = {}, OptionLocale = Locale, ResourceLocales = PickupLocales<NonNullable<Messages>> | PickupLocales<NonNullable<DateTimeFormats>> | PickupLocales<NonNullable<NumberFormats>>, Locales = OptionLocale extends Locale ? IsNever<ResourceLocales> extends true ? Locale : ResourceLocales : OptionLocale | ResourceLocales> extends ComposerCustom {
132 /**
133 * @remarks
134 * Instance ID.
135 */
136 id: number;
137 /**
138 * @remarks
139 * The current locale this Composer instance is using.
140 *
141 * If the locale contains a territory and a dialect, this locale contains an implicit fallback.
142 *
143 * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
144 */
145 locale: WritableComputedRef<Locales>;
146 /**
147 * @remarks
148 * The current fallback locales this Composer instance is using.
149 *
150 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
151 */
152 fallbackLocale: WritableComputedRef<FallbackLocales<Locales>>;
153 /**
154 * @remarks
155 * Whether inherit the root level locale to the component localization locale.
156 *
157 * @VueI18nSee [Local Scope](../guide/essentials/scope#local-scope-2)
158 */
159 inheritLocale: boolean;
160 /**
161 * @remarks
162 * The list of available locales in `messages` in lexical order.
163 */
164 readonly availableLocales: Locales[];
165 /**
166 * @remarks
167 * The locale messages of localization.
168 *
169 * @VueI18nSee [Getting Started](../guide/essentials/started)
170 */
171 readonly messages: ComputedRef<{
172 [K in keyof Messages]: Messages[K];
173 }>;
174 /**
175 * @remarks
176 * The datetime formats of localization.
177 *
178 * @VueI18nSee [Datetime Formatting](../guide/essentials/datetime)
179 */
180 readonly datetimeFormats: ComputedRef<{
181 [K in keyof DateTimeFormats]: DateTimeFormats[K];
182 }>;
183 /**
184 * @remarks
185 * The number formats of localization.
186 *
187 * @VueI18nSee [Number Formatting](../guide/essentials/number)
188 */
189 readonly numberFormats: ComputedRef<{
190 [K in keyof NumberFormats]: NumberFormats[K];
191 }>;
192 /**
193 * @remarks
194 * Custom Modifiers for linked messages.
195 *
196 * @VueI18nSee [Custom Modifiers](../guide/essentials/syntax#custom-modifiers)
197 */
198 readonly modifiers: LinkedModifiers<VueMessageType>;
199 /**
200 * @remarks
201 * A set of rules for word pluralization
202 *
203 * @VueI18nSee [Custom Pluralization](../guide/essentials/pluralization#custom-pluralization)
204 */
205 readonly pluralRules: PluralizationRules;
206 /**
207 * @remarks
208 * Whether this composer instance is global or not
209 */
210 readonly isGlobal: boolean;
211 /**
212 * @remarks
213 * Whether suppress warnings outputted when localization fails.
214 *
215 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
216 */
217 missingWarn: boolean | RegExp;
218 /**
219 * @remarks
220 * Whether suppress fall back warnings when localization fails.
221 *
222 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
223 */
224 fallbackWarn: boolean | RegExp;
225 /**
226 * @remarks
227 * Whether to fall back to root level (global scope) localization when localization fails.
228 *
229 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
230 */
231 fallbackRoot: boolean;
232 /**
233 * @remarks
234 * Whether suppress warnings when falling back to either `fallbackLocale` or root.
235 *
236 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
237 */
238 fallbackFormat: boolean;
239 /**
240 * @remarks
241 * Whether to allow the use locale messages of HTML formatting.
242 *
243 * If you set `false`, will check the locale messages on the Composer instance.
244 *
245 * If you are specified `true`, a warning will be output at console.
246 *
247 * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
248 * @VueI18nSee [Change `warnHtmlInMessage` option default value](../guide/migration/breaking#change-warnhtmlinmessage-option-default-value)
249 */
250 warnHtmlMessage: boolean;
251 /**
252 * @remarks
253 * Whether interpolation parameters are escaped before the message is translated.
254 *
255 * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
256 */
257 escapeParameter: boolean;
258 /**
259 * Locale message translation
260 *
261 * @remarks
262 * About details functions, See the {@link ComposerTranslation}
263 */
264 t: ComposerTranslation<Messages, Locales, RemoveIndexSignature<{
265 [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
266 }>>;
267 /**
268 * Resolve locale message translation
269 *
270 * @remarks
271 * About details functions, See the {@link ComposerResolveLocaleMessageTranslation}
272 */
273 rt: ComposerResolveLocaleMessageTranslation<Locales>;
274 /**
275 * Datetime formatting
276 *
277 * @remarks
278 * About details functions, See the {@link ComposerDateTimeFormatting}
279 */
280 d: ComposerDateTimeFormatting<DateTimeFormats, Locales, RemoveIndexSignature<{
281 [K in keyof DefineDateTimeFormat]: DefineDateTimeFormat[K];
282 }>>;
283 /**
284 * Number Formatting
285 *
286 * @remarks
287 * About details functions, See the {@link ComposerNumberFormatting}
288 */
289 n: ComposerNumberFormatting<NumberFormats, Locales, RemoveIndexSignature<{
290 [K in keyof DefineNumberFormat]: DefineNumberFormat[K];
291 }>>;
292 /**
293 * Translation locale message exist
294 *
295 * @remarks
296 * whether do exist locale message on Composer instance [messages](composition#messages).
297 *
298 * If you specified `locale`, check the locale messages of `locale`.
299 *
300 * @param key - A target locale message key
301 * @param locale - A locale, it will be used over than global scope or local scope
302 *
303 * @returns If found locale message, `true`, else `false`, Note that `false` is returned even if the value present in the key is not translatable, yet if `translateExistCompatible` is set to `true`, it will return `true` if the key is available, even if the value is not translatable.
304 */
305 te<Str extends string, Key extends PickupKeys<Messages> = PickupKeys<Messages>>(key: Str | Key, locale?: Locales): boolean;
306 /**
307 * Locale messages getter
308 *
309 * @remarks
310 * If [UseI18nScope](general#usei18nscope) `'local'` or Some [UseI18nOptions](composition#usei18noptions) are specified at `useI18n`, it’s translated in preferentially local scope locale messages than global scope locale messages.
311 *
312 * Based on the current `locale`, locale messages will be returned from Composer instance messages.
313 *
314 * If you change the `locale`, the locale messages returned will also correspond to the locale.
315 *
316 * If there are no locale messages for the given `key` in the composer instance messages, they will be returned with [fallbacking](../guide/essentials/fallback).
317 *
318 * @VueI18nWarning
319 * You need to use `rt` for the locale message returned by `tm`. see the [rt](composition#rt-message) details.
320 *
321 * @example
322 * template block:
323 * ```html
324 * <div class="container">
325 * <template v-for="content in tm('contents')">
326 * <h2>{{ rt(content.title) }}</h2>
327 * <p v-for="paragraph in content.paragraphs">
328 * {{ rt(paragraph) }}
329 * </p>
330 * </template>
331 * </div>
332 * ```
333 * script block:
334 * ```js
335 * import { defineComponent } from 'vue
336 * import { useI18n } from 'vue-i18n'
337 *
338 * export default defineComponent({
339 * setup() {
340 * const { rt, tm } = useI18n({
341 * messages: {
342 * en: {
343 * contents: [
344 * {
345 * title: 'Title1',
346 * // ...
347 * paragraphs: [
348 * // ...
349 * ]
350 * }
351 * ]
352 * }
353 * }
354 * // ...
355 * })
356 * // ...
357 * return { ... , rt, tm }
358 * }
359 * })
360 * ```
361 *
362 * @param key - A target locale message key
363 *
364 * @return Locale messages
365 */
366 tm<Key extends string, ResourceKeys extends PickupKeys<Messages> = PickupKeys<Messages>, Locale extends PickupLocales<NonNullable<Messages>> = PickupLocales<NonNullable<Messages>>, Target = IsEmptyObject<Messages> extends false ? NonNullable<Messages>[Locale] : RemoveIndexSignature<{
367 [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
368 }>, Return = ResourceKeys extends ResourcePath<Target> ? ResourceValue<Target, ResourceKeys> : Record<string, any>>(key: Key | ResourceKeys): Return;
369 /**
370 * Get locale message
371 *
372 * @remarks
373 * get locale message from Composer instance [messages](composition#messages).
374 *
375 * @param locale - A target locale
376 *
377 * @typeParam MessageSchema - The locale message schema, default `never`
378 *
379 * @returns Locale messages
380 */
381 getLocaleMessage<MessageSchema extends LocaleMessage<VueMessageType> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<Messages>> = PickupLocales<NonNullable<Messages>>, Return = IsNever<MessageSchema> extends true ? IsEmptyObject<Messages> extends true ? RemoveIndexSignature<{
382 [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
383 }> : NonNullable<Messages>[Locale] : MessageSchema>(locale: LocaleSchema | Locale): Return;
384 /**
385 * Set locale message
386 *
387 * @remarks
388 * Set locale message to Composer instance [messages](composition#messages).
389 *
390 * @param locale - A target locale
391 * @param message - A message
392 *
393 * @typeParam MessageSchema - The locale message schema, default `never`
394 */
395 setLocaleMessage<MessageSchema extends LocaleMessage<VueMessageType> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<Messages>> = PickupLocales<NonNullable<Messages>>, MessageType = IsNever<MessageSchema> extends true ? IsEmptyObject<Messages> extends true ? RemoveIndexSignature<{
396 [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
397 }> : NonNullable<Messages>[Locale] : MessageSchema, Message extends MessageType = MessageType>(locale: LocaleSchema | Locale, message: Message): void;
398 /**
399 * Merge locale message
400 *
401 * @remarks
402 * Merge locale message to Composer instance [messages](composition#messages).
403 *
404 * @param locale - A target locale
405 * @param message - A message
406 *
407 * @typeParam MessageSchema - The locale message schema, default `never`
408 */
409 mergeLocaleMessage<MessageSchema extends LocaleMessage<VueMessageType> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<Messages>> = PickupLocales<NonNullable<Messages>>, Message = IsNever<MessageSchema> extends true ? Record<string, any> : MessageSchema>(locale: LocaleSchema | Locale, message: Message): void;
410 /**
411 * Get datetime format
412 *
413 * @remarks
414 * get datetime format from Composer instance [datetimeFormats](composition#datetimeformats).
415 *
416 * @param locale - A target locale
417 *
418 * @typeParam DateTimeSchema - The datetime format schema, default `never`
419 *
420 * @returns Datetime format
421 */
422 getDateTimeFormat<DateTimeSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<DateTimeFormats>> = PickupLocales<NonNullable<DateTimeFormats>>, Return = IsNever<DateTimeSchema> extends true ? IsEmptyObject<DateTimeFormats> extends true ? RemoveIndexSignature<{
423 [K in keyof DefineDateTimeFormat]: DefineDateTimeFormat[K];
424 }> : NonNullable<DateTimeFormats>[Locale] : DateTimeSchema>(locale: LocaleSchema | Locale): Return;
425 /**
426 * Set datetime format
427 *
428 * @remarks
429 * Set datetime format to Composer instance [datetimeFormats](composition#datetimeformats).
430 *
431 * @param locale - A target locale
432 * @param format - A target datetime format
433 *
434 * @typeParam DateTimeSchema - The datetime format schema, default `never`
435 */
436 setDateTimeFormat<DateTimeSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<DateTimeFormats>> = PickupLocales<NonNullable<DateTimeFormats>>, FormatsType = IsNever<DateTimeSchema> extends true ? IsEmptyObject<DateTimeFormats> extends true ? RemoveIndexSignature<{
437 [K in keyof DefineDateTimeFormat]: DefineDateTimeFormat[K];
438 }> : NonNullable<DateTimeFormats>[Locale] : DateTimeSchema, Formats extends FormatsType = FormatsType>(locale: LocaleSchema | Locale, format: Formats): void;
439 /**
440 * Merge datetime format
441 *
442 * @remarks
443 * Merge datetime format to Composer instance [datetimeFormats](composition#datetimeformats).
444 *
445 * @param locale - A target locale
446 * @param format - A target datetime format
447 *
448 * @typeParam DateTimeSchema - The datetime format schema, default `never`
449 */
450 mergeDateTimeFormat<DateTimeSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<DateTimeFormats>> = PickupLocales<NonNullable<DateTimeFormats>>, Formats = IsNever<DateTimeSchema> extends true ? Record<string, any> : DateTimeSchema>(locale: LocaleSchema | Locale, format: Formats): void;
451 /**
452 * Get number format
453 *
454 * @remarks
455 * get number format from Composer instance [numberFormats](composition#numberFormats).
456 *
457 * @param locale - A target locale
458 *
459 * @typeParam NumberSchema - The number format schema, default `never`
460 *
461 * @returns Number format
462 */
463 getNumberFormat<NumberSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<NumberFormats>> = PickupLocales<NonNullable<NumberFormats>>, Return = IsNever<NumberSchema> extends true ? IsEmptyObject<NumberFormats> extends true ? RemoveIndexSignature<{
464 [K in keyof DefineNumberFormat]: DefineNumberFormat[K];
465 }> : NonNullable<NumberFormats>[Locale] : NumberSchema>(locale: LocaleSchema | Locale): Return;
466 /**
467 * Set number format
468 *
469 * @remarks
470 * Set number format to Composer instance [numberFormats](composition#numberFormats).
471 *
472 * @param locale - A target locale
473 * @param format - A target number format
474 *
475 * @typeParam NumberSchema - The number format schema, default `never`
476 */
477 setNumberFormat<NumberSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<NumberFormats>> = PickupLocales<NonNullable<NumberFormats>>, FormatsType = IsNever<NumberSchema> extends true ? IsEmptyObject<NumberFormats> extends true ? RemoveIndexSignature<{
478 [K in keyof DefineNumberFormat]: DefineNumberFormat[K];
479 }> : NonNullable<NumberFormats>[Locale] : NumberSchema, Formats extends FormatsType = FormatsType>(locale: LocaleSchema | Locale, format: Formats): void;
480 /**
481 * Merge number format
482 *
483 * @remarks
484 * Merge number format to Composer instance [numberFormats](composition#numberFormats).
485 *
486 * @param locale - A target locale
487 * @param format - A target number format
488 *
489 * @typeParam NumberSchema - The number format schema, default `never`
490 */
491 mergeNumberFormat<NumberSchema extends Record<string, any> = never, LocaleSchema extends string = string, Locale extends PickupLocales<NonNullable<NumberFormats>> = PickupLocales<NonNullable<NumberFormats>>, Formats = IsNever<NumberSchema> extends true ? Record<string, any> : NumberSchema>(locale: LocaleSchema | Locale, format: Formats): void;
492 /**
493 * Get post translation handler
494 *
495 * @returns {@link PostTranslationHandler}
496 *
497 * @VueI18nSee [missing](composition#posttranslation)
498 */
499 getPostTranslationHandler(): PostTranslationHandler<VueMessageType> | null;
500 /**
501 * Set post translation handler
502 *
503 * @param handler - A {@link PostTranslationHandler}
504 *
505 * @VueI18nSee [missing](composition#posttranslation)
506 */
507 setPostTranslationHandler(handler: PostTranslationHandler<VueMessageType> | null): void;
508 /**
509 * Get missing handler
510 *
511 * @returns {@link MissingHandler}
512 *
513 * @VueI18nSee [missing](composition#missing)
514 */
515 getMissingHandler(): MissingHandler | null;
516 /**
517 * Set missing handler
518 *
519 * @param handler - A {@link MissingHandler}
520 *
521 * @VueI18nSee [missing](composition#missing)
522 */
523 setMissingHandler(handler: MissingHandler | null): void;
524}
525
526/**
527 * Composer additional options for `useI18n`
528 *
529 * @remarks
530 * `ComposerAdditionalOptions` is extend for {@link ComposerOptions}, so you can specify these options.
531 *
532 * @VueI18nSee [useI18n](composition#usei18n)
533 *
534 * @VueI18nComposition
535 */
536export declare interface ComposerAdditionalOptions {
537 useScope?: I18nScope;
538}
539
540/**
541 * The type custom definition of Composer
542 *
543 * @remarks
544 *
545 * The interface that can extend Composer.
546 *
547 * The type defined by 3rd party (e.g. nuxt/i18n)
548 *
549 * @example
550 * ```ts
551 * // vue-i18n.d.ts (`.d.ts` file at your app)
552 *
553 * declare module 'vue-i18n' {
554 * interface ComposerCustom {
555 * localeCodes: string[]
556 * }
557 * }
558 * ```
559 *
560 * @VueI18nComposition
561 */
562export declare interface ComposerCustom {
563}
564
565/**
566 * Datetime formatting functions
567 *
568 * @remarks
569 * This is the interface for {@link Composer}
570 *
571 * @VueI18nComposition
572 */
573export declare interface ComposerDateTimeFormatting<DateTimeFormats extends Record<string, any> = {}, Locales = 'en-US', DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>, C = IsEmptyObject<DefinedDateTimeFormat> extends false ? PickupFormatPathKeys<{
574 [K in keyof DefinedDateTimeFormat]: DefinedDateTimeFormat[K];
575}> : never, M = IsEmptyObject<DateTimeFormats> extends false ? PickupFormatKeys<DateTimeFormats> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
576 /**
577 * Datetime formatting
578 *
579 * @remarks
580 * If this is used in a reactive context, it will re-evaluate once the locale changes.
581 *
582 * If [UseI18nScope](general#usei18nscope) `'local'` or Some [UseI18nOptions](composition#usei18noptions) are specified at `useI18n`, it’s translated in preferentially local scope datetime formats than global scope datetime formats.
583 *
584 * If not, then it’s formatted with global scope datetime formats.
585 *
586 * @param value - A value, timestamp number or `Date` instance or ISO 8601 string
587 *
588 * @returns Formatted value
589 *
590 * @VueI18nSee [Datetime formatting](../guide/essentials/datetime)
591 */
592 (value: number | Date | string): string;
593 /**
594 * Datetime formatting
595 *
596 * @remarks
597 * Overloaded `d`. About details, see the [call signature](composition#value-number-date-string-string) details.
598 *
599 * In this overloaded `d`, format in datetime format for a key registered in datetime formats.
600 *
601 * @param value - A value, timestamp number or `Date` instance or ISO 8601 string
602 * @param keyOrOptions - A key of datetime formats, or additional {@link DateTimeOptions | options} for datetime formatting
603 *
604 * @returns Formatted value
605 */
606 <Value extends number | Date | string = number, Key extends string = string>(value: Value, keyOrOptions: Key | ResourceKeys | DateTimeOptions<Key | ResourceKeys, Locales>): string;
607 /**
608 * Datetime formatting
609 *
610 * @remarks
611 * Overloaded `d`. About details, see the [call signature](composition#value-number-date-string-string) details.
612 *
613 * In this overloaded `d`, format in datetime format for a key registered in datetime formats at target locale
614 *
615 * @param value - A value, timestamp number or `Date` instance or ISO 8601 string
616 * @param keyOrOptions - A key of datetime formats, or additional {@link DateTimeOptions | options} for datetime formatting
617 * @param locale - A locale, it will be used over than global scope or local scope.
618 *
619 * @returns Formatted value
620 */
621 <Value extends number | Date | string = number, Key extends string = string>(value: Value, keyOrOptions: Key | ResourceKeys | DateTimeOptions<Key | ResourceKeys, Locales>, locale: Locales): string;
622}
623
624export declare type ComposerExtender = (composer: Composer) => Disposer | undefined;
625
626/**
627 * Number formatting functions
628 *
629 * @remarks
630 * This is the interface for {@link Composer}
631 *
632 * @VueI18nComposition
633 */
634export declare interface ComposerNumberFormatting<NumberFormats extends Record<string, any> = {}, Locales = 'en-US', DefinedNumberFormat extends RemovedIndexResources<DefineNumberFormat> = RemovedIndexResources<DefineNumberFormat>, C = IsEmptyObject<DefinedNumberFormat> extends false ? PickupFormatPathKeys<{
635 [K in keyof DefinedNumberFormat]: DefinedNumberFormat[K];
636}> : never, M = IsEmptyObject<NumberFormats> extends false ? PickupFormatKeys<NumberFormats> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
637 /**
638 * Number Formatting
639 *
640 * @remarks
641 * If this is used in a reactive context, it will re-evaluate once the locale changes.
642 *
643 * If [UseI18nScope](general#usei18nscope) `'local'` or Some [UseI18nOptions](composition#usei18noptions) are specified at `useI18n`, it’s translated in preferentially local scope datetime formats than global scope datetime formats.
644 *
645 * If not, then it’s formatted with global scope number formats.
646 *
647 * @param value - A number value
648 *
649 * @returns Formatted value
650 *
651 * @VueI18nSee [Number formatting](../guide/essentials/number)
652 */
653 (value: number): string;
654 /**
655 * Number Formatting
656 *
657 * @remarks
658 * Overloaded `n`. About details, see the [call signature](composition#value-number-string) details.
659 *
660 * In this overloaded `n`, format in number format for a key registered in number formats.
661 *
662 * @param value - A number value
663 * @param keyOrOptions - A key of number formats, or additional {@link NumberOptions | options} for number formatting
664 *
665 * @returns Formatted value
666 */
667 <Key extends string = string>(value: number, keyOrOptions: Key | ResourceKeys | NumberOptions<Key | ResourceKeys, Locales>): string;
668 /**
669 * Number Formatting
670 *
671 * @remarks
672 * Overloaded `n`. About details, see the [call signature](composition#value-number-string) details.
673 *
674 * In this overloaded `n`, format in number format for a key registered in number formats at target locale.
675 *
676 * @param value - A number value
677 * @param keyOrOptions - A key of number formats, or additional {@link NumberOptions | options} for number formatting
678 * @param locale - A locale, it will be used over than global scope or local scope.
679 *
680 * @returns Formatted value
681 */
682 <Key extends string = string>(value: number, keyOrOptions: Key | ResourceKeys | NumberOptions<Key | ResourceKeys, Locales>, locale: Locales): string;
683}
684
685/**
686 * Composer Options
687 *
688 * @remarks
689 * This is options to create composer.
690 *
691 * @VueI18nComposition
692 */
693export declare interface ComposerOptions<Schema extends {
694 message?: unknown;
695 datetime?: unknown;
696 number?: unknown;
697} = {
698 message: DefaultLocaleMessageSchema;
699 datetime: DefaultDateTimeFormatSchema;
700 number: DefaultNumberFormatSchema;
701}, Locales extends {
702 messages: unknown;
703 datetimeFormats: unknown;
704 numberFormats: unknown;
705} | string = Locale, MessagesLocales = Locales extends {
706 messages: infer M;
707} ? M : Locales extends string ? Locales : Locale, DateTimeFormatsLocales = Locales extends {
708 datetimeFormats: infer D;
709} ? D : Locales extends string ? Locales : Locale, NumberFormatsLocales = Locales extends {
710 numberFormats: infer N;
711} ? N : Locales extends string ? Locales : Locale, MessageSchema = Schema extends {
712 message: infer M;
713} ? M : DefaultLocaleMessageSchema, DateTimeSchema = Schema extends {
714 datetime: infer D;
715} ? D : DefaultDateTimeFormatSchema, NumberSchema = Schema extends {
716 number: infer N;
717} ? N : DefaultNumberFormatSchema, _Messages extends LocaleMessages<MessageSchema, MessagesLocales, VueMessageType> = LocaleMessages<MessageSchema, MessagesLocales, VueMessageType>, _DateTimeFormats extends IntlDateTimeFormats<DateTimeSchema, DateTimeFormatsLocales> = IntlDateTimeFormats<DateTimeSchema, DateTimeFormatsLocales>, _NumberFormats extends IntlNumberFormats<NumberSchema, NumberFormatsLocales> = IntlNumberFormats<NumberSchema, NumberFormatsLocales>> {
718 /**
719 * @remarks
720 * The locale of localization.
721 *
722 * If the locale contains a territory and a dialect, this locale contains an implicit fallback.
723 *
724 * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
725 *
726 * @defaultValue `'en-US'`
727 */
728 locale?: Locale;
729 /**
730 * @remarks
731 * The locale of fallback localization.
732 *
733 * For more complex fallback definitions see fallback.
734 *
735 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
736 *
737 * @defaultValue The default `'en-US'` for the `locale` if it's not specified, or it's `locale` value
738 */
739 fallbackLocale?: FallbackLocale;
740 /**
741 * @remarks
742 * Whether inheritance the root level locale to the component localization locale.
743 *
744 * If `false`, regardless of the root level locale, localize for each component locale.
745 *
746 * @VueI18nSee [Local Scope](../guide/essentials/scope#local-scope-2)
747 *
748 * @defaultValue `true`
749 */
750 inheritLocale?: boolean;
751 /**
752 * @remarks
753 * The locale messages of localization.
754 *
755 * @VueI18nSee [Getting Started](../guide/essentials/started)
756 *
757 * @defaultValue `{}`
758 */
759 messages?: {
760 [K in keyof _Messages]: MessageSchema;
761 };
762 /**
763 * @remarks
764 * Allow use flat json messages or not
765 *
766 * @defaultValue `false`
767 */
768 flatJson?: boolean;
769 /**
770 * @remarks
771 * The datetime formats of localization.
772 *
773 * @VueI18nSee [Datetime Formatting](../guide/essentials/datetime)
774 *
775 * @defaultValue `{}`
776 */
777 datetimeFormats?: {
778 [K in keyof _DateTimeFormats]: DateTimeSchema;
779 };
780 /**
781 * @remarks
782 * The number formats of localization.
783 *
784 * @VueI18nSee [Number Formatting](../guide/essentials/number)
785 *
786 * @defaultValue `{}`
787 */
788 numberFormats?: {
789 [K in keyof _NumberFormats]: NumberSchema;
790 };
791 /**
792 * @remarks
793 * Custom Modifiers for linked messages.
794 *
795 * @VueI18nSee [Custom Modifiers](../guide/essentials/syntax#custom-modifiers)
796 */
797 modifiers?: LinkedModifiers<VueMessageType>;
798 /**
799 * @remarks
800 * A set of rules for word pluralization
801 *
802 * @VueI18nSee [Custom Pluralization](../guide/essentials/pluralization#custom-pluralization)
803 *
804 * @defaultValue `{}`
805 */
806 pluralRules?: PluralizationRules;
807 /**
808 * @remarks
809 * A handler for localization missing.
810 *
811 * The handler gets called with the localization target locale, localization path key, the Vue instance and values.
812 *
813 * If missing handler is assigned, and occurred localization missing, it's not warned.
814 *
815 * @defaultValue `null`
816 */
817 missing?: MissingHandler;
818 /**
819 * @remarks
820 * Whether suppress warnings outputted when localization fails.
821 *
822 * If `false`, suppress localization fail warnings.
823 *
824 * If you use regular expression, you can suppress localization fail warnings that it match with translation key (e.g. `t`).
825 *
826 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
827 *
828 * @defaultValue `true`
829 */
830 missingWarn?: boolean | RegExp;
831 /**
832 * @remarks
833 * Whether suppress warnings when falling back to either `fallbackLocale` or root.
834 *
835 * If `false`, suppress fall back warnings.
836 *
837 * If you use regular expression, you can suppress fallback warnings that it match with translation key (e.g. `t`).
838 *
839 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
840 *
841 * @defaultValue `true`
842 */
843 fallbackWarn?: boolean | RegExp;
844 /**
845 * @remarks
846 * In the component localization, whether to fallback to root level (global scope) localization when localization fails.
847 *
848 * If `false`, it's not fallback to root.
849 *
850 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
851 *
852 * @defaultValue `true`
853 */
854 fallbackRoot?: boolean;
855 /**
856 * @remarks
857 * Whether do template interpolation on translation keys when your language lacks a translation for a key.
858 *
859 * If `true`, skip writing templates for your "base" language; the keys are your templates.
860 *
861 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
862 *
863 * @defaultValue `false`
864 */
865 fallbackFormat?: boolean;
866 /**
867 * @remarks
868 * A handler for post processing of translation.
869 *
870 * The handler gets after being called with the `t`.
871 *
872 * This handler is useful if you want to filter on translated text such as space trimming.
873 *
874 * @defaultValue `null`
875 */
876 postTranslation?: PostTranslationHandler<VueMessageType>;
877 /**
878 * @remarks
879 * Whether to allow the use locale messages of HTML formatting.
880 *
881 * See the warnHtmlMessage property.
882 *
883 * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
884 * @VueI18nSee [Change `warnHtmlInMessage` option default value](../guide/migration/breaking#change-warnhtmlinmessage-option-default-value)
885 *
886 * @defaultValue `'off'`
887 */
888 warnHtmlMessage?: boolean;
889 /**
890 * @remarks
891 * If `escapeParameter` is configured as true then interpolation parameters are escaped before the message is translated.
892 *
893 * This is useful when translation output is used in `v-html` and the translation resource contains html markup (e.g. <b> around a user provided value).
894 *
895 * This usage pattern mostly occurs when passing precomputed text strings into UI components.
896 *
897 * The escape process involves replacing the following symbols with their respective HTML character entities: `<`, `>`, `"`, `'`.
898 *
899 * Setting `escapeParameter` as true should not break existing functionality but provides a safeguard against a subtle type of XSS attack vectors.
900 *
901 * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
902 *
903 * @defaultValue `false`
904 */
905 escapeParameter?: boolean;
906 /**
907 * @remarks
908 * A message resolver to resolve [`messages`](composition#messages).
909 *
910 * If not specified, the vue-i18n internal message resolver will be used by default.
911 *
912 * You need to implement a message resolver yourself that supports the following requirements:
913 *
914 * - Resolve the message using the locale message of [`locale`](composition#locale) passed as the first argument of the message resolver, and the path passed as the second argument.
915 *
916 * - If the message could not be resolved, you need to return `null`.
917 *
918 * - If you will be returned `null`, the message resolver will also be called on fallback if [`fallbackLocale`](composition#fallbacklocale-2) is enabled, so the message will need to be resolved as well.
919 *
920 * The message resolver is called indirectly by the following APIs:
921 *
922 * - [`t`](composition#t-key)
923 *
924 * - [`te`](composition#te-key-locale)
925 *
926 * - [`tm`](composition#tm-key)
927 *
928 * - [Translation component](component#translation)
929 *
930 * @example
931 * Here is an example of how to set it up using your `createI18n`:
932 * ```js
933 * import { createI18n } from 'vue-i18n'
934 *
935 * // your message resolver
936 * function messageResolver(obj, path) {
937 * // simple message resolving!
938 * const msg = obj[path]
939 * return msg != null ? msg : null
940 * }
941 *
942 * // call with I18n option
943 * const i18n = createI18n({
944 * legacy: false,
945 * locale: 'ja',
946 * messageResolver, // set your message resolver
947 * messages: {
948 * en: { ... },
949 * ja: { ... }
950 * }
951 * })
952 *
953 * // the below your something to do ...
954 * // ...
955 * ```
956 *
957 * @VueI18nTip
958 * :new: v9.2+
959 *
960 * @VueI18nWarning
961 * If you use the message resolver, the [`flatJson`](composition#flatjson) setting will be ignored. That is, you need to resolve the flat JSON by yourself.
962 *
963 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
964 *
965 * @defaultValue `undefined`
966 */
967 messageResolver?: MessageResolver;
968 /**
969 * @remarks
970 * A compiler for custom message format.
971 *
972 * If not specified, the vue-i18n default message compiler will be used.
973 *
974 * You will need to implement your own message compiler that returns Message Functions
975 *
976 * @example
977 * Here is an example of how to custom message compiler with `intl-messageformat`
978 *
979 * ```js
980 * import { createI18n } from 'vue-i18n'
981 * import IntlMessageFormat from 'intl-messageformat'
982 *
983 * function messageCompiler(message, { locale, key, onError }) {
984 * if (typeof message === 'string') {
985 * // You can tune your message compiler performance more with your cache strategy or also memoization at here
986 * const formatter = new IntlMessageFormat(message, locale)
987 * return ctx => formatter.format(ctx.values)
988 * } else {
989 * // If you would like to support it for AST,
990 * // You need to transform locale mesages such as `json`, `yaml`, etc. with the bundle plugin.
991 * onError && onError(new Error('not support for AST'))
992 * return () => key // return default with `key`
993 * }
994 * }
995 *
996 * // call with I18n option
997 * const i18n = createI18n({
998 * legacy: false,
999 * locale: 'ja',
1000 * messageCompiler, // set your message compiler
1001 * messages: {
1002 * en: {
1003 * hello: 'hello world!',
1004 * greeting: 'hi, {name}!',
1005 * // ICU Message format
1006 * photo: `You have {numPhotos, plural,
1007 * =0 {no photos.}
1008 * =1 {one photo.}
1009 * other {# photos.}
1010 * }`
1011 * },
1012 * }
1013 * })
1014 *
1015 * // the below your something to do ...
1016 * // ...
1017 * ```
1018 *
1019 * @VueI18nTip
1020 * :new: v9.3+
1021 *
1022 * @VueI18nWarning
1023 * The Custom Message Format is an experimental feature. It may receive breaking changes or be removed in the future.
1024 *
1025 * @VueI18nSee [Custom Message Format](../guide/advanced/format)
1026 *
1027 * @defaultValue `undefined`
1028 */
1029 messageCompiler?: MessageCompiler;
1030 /**
1031 * @remarks
1032 * An option to make `te` behavior specification before v9.6
1033 *
1034 * @VueI18nTip
1035 * :new: v9.10+
1036 *
1037 * @VueI18nWarning
1038 * This flag will be removed in v10.
1039 *
1040 * @VueI18nSee [GitHub Issue](https://github.com/intlify/vue-i18n-next/issues/1738)
1041 *
1042 * @VueI18nSee [`te`](composition#te-key-locale)
1043 *
1044 * @defaultValue `false`
1045 *
1046 */
1047 translateExistCompatible?: boolean;
1048}
1049
1050/**
1051 * Resolve locale message translation functions
1052 *
1053 * @remarks
1054 * This is the interface for {@link Composer}
1055 *
1056 * @VueI18nComposition
1057 */
1058export declare interface ComposerResolveLocaleMessageTranslation<Locales = 'en-US'> {
1059 /**
1060 * Resolve locale message translation
1061 *
1062 * @remarks
1063 * If this is used in a reactive context, it will re-evaluate once the locale changes.
1064 *
1065 * If [UseI18nScope](general#usei18nscope) `'local'` or Some [UseI18nOptions](composition#usei18noptions) are specified at `useI18n`, it’s translated in preferentially local scope locale messages than global scope locale messages.
1066 *
1067 * If not, then it’s translated with global scope locale messages.
1068 *
1069 * @VueI18nTip
1070 * The use-case for `rt` is for programmatic locale messages translation with using `tm`, `v-for`, javascript `for` statement.
1071 *
1072 * @VueI18nWarning
1073 * `rt` differs from `t` in that it processes the locale message directly, not the key of the locale message. There is no internal fallback with `rt`. You need to understand and use the structure of the locale messge returned by `tm`.
1074 *
1075 * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `tm`.
1076 *
1077 * @returns Translated message
1078 *
1079 * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
1080 */
1081 (message: MessageFunction<VueMessageType> | VueMessageType): string;
1082 /**
1083 * Resolve locale message translation for plurals
1084 *
1085 * @remarks
1086 * Overloaded `rt`. About details, see the [call signature](composition#message-messagefunction-message-message-string) details.
1087 *
1088 * In this overloaded `rt`, return a pluralized translation message.
1089 *
1090 * @VueI18nTip
1091 * The use-case for `rt` is for programmatic locale messages translation with using `tm`, `v-for`, javascript `for` statement.
1092 *
1093 * @VueI18nWarning
1094 * `rt` differs from `t` in that it processes the locale message directly, not the key of the locale message. There is no internal fallback with `rt`. You need to understand and use the structure of the locale messge returned by `tm`.
1095 *
1096 * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `tm`.
1097 * @param plural - Which plural string to get. 1 returns the first one.
1098 * @param options - Additional {@link TranslateOptions | options} for translation
1099 *
1100 * @returns Translated message
1101 *
1102 * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
1103 */
1104 (message: MessageFunction<VueMessageType> | VueMessageType, plural: number, options?: TranslateOptions<Locales>): string;
1105 /**
1106 * Resolve locale message translation for list interpolations
1107 *
1108 * @remarks
1109 * Overloaded `rt`. About details, see the [call signature](composition#message-messagefunction-message-message-string) details.
1110 *
1111 * In this overloaded `rt`, return a pluralized translation message.
1112 *
1113 * @VueI18nTip
1114 * The use-case for `rt` is for programmatic locale messages translation with using `tm`, `v-for`, javascript `for` statement.
1115 *
1116 * @VueI18nWarning
1117 * `rt` differs from `t` in that it processes the locale message directly, not the key of the locale message. There is no internal fallback with `rt`. You need to understand and use the structure of the locale messge returned by `tm`.
1118 *
1119 * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `tm`.
1120 * @param list - A values of list interpolation.
1121 * @param options - Additional {@link TranslateOptions | options} for translation
1122 *
1123 * @returns Translated message
1124 *
1125 * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
1126 */
1127 (message: MessageFunction<VueMessageType> | VueMessageType, list: unknown[], options?: TranslateOptions<Locales>): string;
1128 /**
1129 * Resolve locale message translation for named interpolations
1130 *
1131 * @remarks
1132 * Overloaded `rt`. About details, see the [call signature](composition#message-messagefunction-message-message-string) details.
1133 *
1134 * In this overloaded `rt`, for each placeholder x, the locale messages should contain a `{x}` token.
1135 *
1136 * @VueI18nTip
1137 * The use-case for `rt` is for programmatic locale messages translation with using `tm`, `v-for`, javascript `for` statement.
1138 *
1139 * @VueI18nWarning
1140 * `rt` differs from `t` in that it processes the locale message directly, not the key of the locale message. There is no internal fallback with `rt`. You need to understand and use the structure of the locale messge returned by `tm`.
1141 *
1142 * @param message - A target locale message to be resolved. You will need to specify the locale message returned by `tm`.
1143 * @param named - A values of named interpolation.
1144 * @param options - Additional {@link TranslateOptions | options} for translation
1145 *
1146 * @returns Translated message
1147 *
1148 * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
1149 */
1150 (message: MessageFunction<VueMessageType> | VueMessageType, named: NamedValue, options?: TranslateOptions<Locales>): string;
1151}
1152
1153/**
1154 * Locale message translation functions
1155 *
1156 * @remarks
1157 * This is the interface for {@link Composer}
1158 *
1159 * @VueI18nComposition
1160 */
1161export declare interface ComposerTranslation<Messages extends Record<string, any> = {}, Locales = 'en-US', DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>, C = IsEmptyObject<DefinedLocaleMessage> extends false ? PickupPaths<{
1162 [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K];
1163}> : never, M = IsEmptyObject<Messages> extends false ? PickupKeys<Messages> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
1164 /**
1165 * Locale message translation
1166 *
1167 * @remarks
1168 * If this is used in a reactive context, it will re-evaluate once the locale changes.
1169 *
1170 * If [UseI18nScope](general#usei18nscope) `'local'` or Some [UseI18nOptions](composition#usei18noptions) are specified at `useI18n`, it’s translated in preferentially local scope locale messages than global scope locale messages.
1171 *
1172 * If not, then it’s translated with global scope locale messages.
1173 *
1174 * @param key - A target locale message key
1175 *
1176 * @returns Translated message
1177 *
1178 * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
1179 */
1180 <Key extends string>(key: Key | ResourceKeys | number): string;
1181 /**
1182 * Locale message translation for plurals
1183 *
1184 * @remarks
1185 * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
1186 *
1187 * In this overloaded `t`, return a pluralized translation message.
1188 *
1189 * You can also suppress the warning, when the translation missing according to the options.
1190 *
1191 * About details of options, see the {@link TranslateOptions}.
1192 *
1193 * @param key - A target locale message key
1194 * @param plural - Which plural string to get. 1 returns the first one.
1195 * @param options - Additional {@link TranslateOptions | options} for translation
1196 *
1197 * @returns Translated message
1198 *
1199 * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
1200 */
1201 <Key extends string>(key: Key | ResourceKeys | number, plural: number, options?: TranslateOptions<Locales>): string;
1202 /**
1203 * Locale message translation for missing default message
1204 *
1205 * @remarks
1206 * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
1207 *
1208 * In this overloaded `t`, if no translation was found, return a default message.
1209 *
1210 * You can also suppress the warning, when the translation missing according to the options.
1211 *
1212 * About details of options, see the {@link TranslateOptions}.
1213 *
1214 * @param key - A target locale message key
1215 * @param defaultMsg - A default message to return if no translation was found
1216 * @param options - Additional {@link TranslateOptions | options} for translation
1217 *
1218 * @returns Translated message
1219 */
1220 <Key extends string>(key: Key | ResourceKeys | number, defaultMsg: string, options?: TranslateOptions<Locales>): string;
1221 /**
1222 * Locale message translation for list interpolations
1223 *
1224 * @remarks
1225 * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
1226 *
1227 * In this overloaded `t`, the locale messages should contain a `{0}`, `{1}`, … for each placeholder in the list.
1228 *
1229 * You can also suppress the warning, when the translation missing according to the options.
1230 *
1231 * About details of options, see the {@link TranslateOptions}.
1232 *
1233 * @param key - A target locale message key
1234 * @param list - A values of list interpolation
1235 * @param options - Additional {@link TranslateOptions | options} for translation
1236 *
1237 * @returns Translated message
1238 *
1239 * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
1240 */
1241 <Key extends string>(key: Key | ResourceKeys | number, list: unknown[], options?: TranslateOptions<Locales>): string;
1242 /**
1243 * Locale message translation for list interpolations and plurals
1244 *
1245 * @remarks
1246 * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
1247 *
1248 * In this overloaded `t`, the locale messages should contain a `{0}`, `{1}`, … for each placeholder in the list, and return a pluralized translation message.
1249 *
1250 * @param key - A target locale message key
1251 * @param list - A values of list interpolation
1252 * @param plural - Which plural string to get. 1 returns the first one.
1253 *
1254 * @returns Translated message
1255 *
1256 * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
1257 * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
1258 */
1259 <Key extends string>(key: Key | ResourceKeys | number, list: unknown[], plural: number): string;
1260 /**
1261 * Locale message translation for list interpolations and missing default message
1262 *
1263 * @remarks
1264 * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
1265 *
1266 * In this overloaded `t`, the locale messages should contain a `{0}`, `{1}`, … for each placeholder in the list, and if no translation was found, return a default message.
1267 *
1268 * @param key - A target locale message key
1269 * @param list - A values of list interpolation
1270 * @param defaultMsg - A default message to return if no translation was found
1271 *
1272 * @returns Translated message
1273 *
1274 * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
1275 */
1276 <Key extends string>(key: Key | ResourceKeys | number, list: unknown[], defaultMsg: string): string;
1277 /**
1278 * Locale message translation for named interpolations
1279 *
1280 * @remarks
1281 * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
1282 *
1283 * In this overloaded `t`, for each placeholder x, the locale messages should contain a `{x}` token.
1284 *
1285 * You can also suppress the warning, when the translation missing according to the options.
1286 *
1287 * About details of options, see the {@link TranslateOptions}.
1288 *
1289 * @param key - A target locale message key
1290 * @param named - A values of named interpolation
1291 * @param options - Additional {@link TranslateOptions | options} for translation
1292 *
1293 * @returns Translated message
1294 *
1295 * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
1296 */
1297 <Key extends string>(key: Key | ResourceKeys | number, named: NamedValue, options?: TranslateOptions<Locales>): string;
1298 /**
1299 * Locale message translation for named interpolations and plurals
1300 *
1301 * @remarks
1302 * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
1303 *
1304 * In this overloaded `t`, for each placeholder x, the locale messages should contain a `{x}` token, and return a pluralized translation message.
1305 *
1306 * @param key - A target locale message key
1307 * @param named - A values of named interpolation
1308 * @param plural - Which plural string to get. 1 returns the first one.
1309 *
1310 * @returns Translated message
1311 *
1312 * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
1313 * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
1314 */
1315 <Key extends string>(key: Key | ResourceKeys | number, named: NamedValue, plural: number): string;
1316 /**
1317 * Locale message translation for named interpolations and plurals
1318 *
1319 * @remarks
1320 * Overloaded `t`. About details, see the [call signature](composition#key-key-resourcekeys-number-string) details.
1321 *
1322 * In this overloaded `t`, for each placeholder x, the locale messages should contain a `{x}` token, and if no translation was found, return a default message.
1323 *
1324 * @param key - A target locale message key
1325 * @param named - A values of named interpolation
1326 * @param defaultMsg - A default message to return if no translation was found
1327 *
1328 * @returns Translated message
1329 *
1330 * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
1331 */
1332 <Key extends string>(key: Key | ResourceKeys | number, named: NamedValue, defaultMsg: string): string;
1333}
1334
1335export declare function createI18n<Legacy extends boolean = true, Options extends I18nOptions = I18nOptions, Messages extends Record<string, unknown> = Options['messages'] extends Record<string, unknown> ? Options['messages'] : {}, DateTimeFormats extends Record<string, unknown> = Options['datetimeFormats'] extends Record<string, unknown> ? Options['datetimeFormats'] : {}, NumberFormats extends Record<string, unknown> = Options['numberFormats'] extends Record<string, unknown> ? Options['numberFormats'] : {}, OptionLocale = Options['locale'] extends string ? Options['locale'] : Locale>(options: Options, LegacyVueI18n?: any): (typeof options)['legacy'] extends true ? I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, true> : (typeof options)['legacy'] extends false ? I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, false> : I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, Legacy>;
1336
1337/**
1338 * Vue I18n factory
1339 *
1340 * @param options - An options, see the {@link I18nOptions}
1341 *
1342 * @typeParam Schema - The i18n resources (messages, datetimeFormats, numberFormats) schema, default {@link LocaleMessage}
1343 * @typeParam Locales - The locales of i18n resource schema, default `en-US`
1344 * @typeParam Legacy - Whether legacy mode is enabled or disabled, default `true`
1345 *
1346 * @returns {@link I18n} instance
1347 *
1348 * @remarks
1349 * If you use Legacy API mode, you need to specify {@link VueI18nOptions} and `legacy: true` option.
1350 *
1351 * If you use composition API mode, you need to specify {@link ComposerOptions}.
1352 *
1353 * @VueI18nSee [Getting Started](../guide/essentials/started)
1354 * @VueI18nSee [Composition API](../guide/advanced/composition)
1355 *
1356 * @example
1357 * case: for Legacy API
1358 * ```js
1359 * import { createApp } from 'vue'
1360 * import { createI18n } from 'vue-i18n'
1361 *
1362 * // call with I18n option
1363 * const i18n = createI18n({
1364 * locale: 'ja',
1365 * messages: {
1366 * en: { ... },
1367 * ja: { ... }
1368 * }
1369 * })
1370 *
1371 * const App = {
1372 * // ...
1373 * }
1374 *
1375 * const app = createApp(App)
1376 *
1377 * // install!
1378 * app.use(i18n)
1379 * app.mount('#app')
1380 * ```
1381 *
1382 * @example
1383 * case: for composition API
1384 * ```js
1385 * import { createApp } from 'vue'
1386 * import { createI18n, useI18n } from 'vue-i18n'
1387 *
1388 * // call with I18n option
1389 * const i18n = createI18n({
1390 * legacy: false, // you must specify 'legacy: false' option
1391 * locale: 'ja',
1392 * messages: {
1393 * en: { ... },
1394 * ja: { ... }
1395 * }
1396 * })
1397 *
1398 * const App = {
1399 * setup() {
1400 * // ...
1401 * const { t } = useI18n({ ... })
1402 * return { ... , t }
1403 * }
1404 * }
1405 *
1406 * const app = createApp(App)
1407 *
1408 * // install!
1409 * app.use(i18n)
1410 * app.mount('#app')
1411 * ```
1412 *
1413 * @VueI18nGeneral
1414 */
1415export declare function createI18n<Schema extends object = DefaultLocaleMessageSchema, Locales extends string | object = 'en-US', Legacy extends boolean = true, Options extends I18nOptions<SchemaParams<Schema, VueMessageType>, LocaleParams<Locales>> = I18nOptions<SchemaParams<Schema, VueMessageType>, LocaleParams<Locales>>, Messages extends Record<string, unknown> = NonNullable<Options['messages']> extends Record<string, unknown> ? NonNullable<Options['messages']> : {}, DateTimeFormats extends Record<string, unknown> = NonNullable<Options['datetimeFormats']> extends Record<string, unknown> ? NonNullable<Options['datetimeFormats']> : {}, NumberFormats extends Record<string, unknown> = NonNullable<Options['numberFormats']> extends Record<string, unknown> ? NonNullable<Options['numberFormats']> : {}, OptionLocale = Options['locale'] extends string ? Options['locale'] : Locale>(options: Options, LegacyVueI18n?: any): (typeof options)['legacy'] extends true ? I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, true> : (typeof options)['legacy'] extends false ? I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, false> : I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, Legacy>;
1416
1417export declare interface CustomBlock<Message = VueMessageType> {
1418 locale: Locale;
1419 resource: LocaleMessages<Message>;
1420}
1421
1422export declare type CustomBlocks<Message = VueMessageType> = Array<CustomBlock<Message>>;
1423
1424/**
1425 * Datetime Format Component
1426 *
1427 * @remarks
1428 * See the following items for property about details
1429 *
1430 * @VueI18nSee [FormattableProps](component#formattableprops)
1431 * @VueI18nSee [BaseFormatProps](component#baseformatprops)
1432 * @VueI18nSee [Custom Formatting](../guide/essentials/datetime#custom-formatting)
1433 *
1434 * @VueI18nDanger
1435 * Not supported IE, due to no support `Intl.DateTimeFormat#formatToParts` in [IE](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts)
1436 *
1437 * If you want to use it, you need to use [polyfill](https://github.com/formatjs/formatjs/tree/main/packages/intl-datetimeformat)
1438 *
1439 * @VueI18nComponent
1440 */
1441export declare const DatetimeFormat: new () => {
1442 $props: VNodeProps & DatetimeFormatProps & BaseFormatProps;
1443};
1444
1445/**
1446 * DatetimeFormat Component Props
1447 *
1448 * @VueI18nComponent
1449 */
1450export declare type DatetimeFormatProps = FormattableProps<number | Date, Intl.DateTimeFormatOptions>;
1451
1452/** @VueI18nLegacy */
1453export declare type DateTimeFormatResult = string;
1454export { DateTimeOptions }
1455
1456export declare type DefaultDateTimeFormatSchema<Schema = RemoveIndexSignature<{
1457 [K in keyof DefineDateTimeFormat]: DefineDateTimeFormat[K];
1458}>> = IsEmptyObject<Schema> extends true ? IntlDateTimeFormat : Schema;
1459
1460export declare type DefaultLocaleMessageSchema<Schema = RemoveIndexSignature<{
1461 [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
1462}>> = IsEmptyObject<Schema> extends true ? LocaleMessage<VueMessageType> : Schema;
1463
1464export declare type DefaultNumberFormatSchema<Schema = RemoveIndexSignature<{
1465 [K in keyof DefineNumberFormat]: DefineNumberFormat[K];
1466}>> = IsEmptyObject<Schema> extends true ? IntlNumberFormat : Schema;
1467
1468/**
1469 * The type definition of datetime format
1470 *
1471 * @remarks
1472 * The typealias is used to strictly define the type of the Datetime format.
1473 *
1474 * The type defined by this can be used in the global scope.
1475 *
1476 * @example
1477 * ```ts
1478 * // type.d.ts (`.d.ts` file at your app)
1479 * import { DefineDateTimeFormat } from 'vue-i18n'
1480 *
1481 * declare module 'vue-i18n' {
1482 * export interface DefineDateTimeFormat {
1483 * short: {
1484 * hour: 'numeric'
1485 * timezone: string
1486 * }
1487 * }
1488 * }
1489 * ```
1490 *
1491 * @VueI18nGeneral
1492 */
1493export declare interface DefineDateTimeFormat extends IntlDateTimeFormat {
1494}
1495
1496/**
1497 * The type definition of Locale Message
1498 *
1499 * @remarks
1500 * The typealias is used to strictly define the type of the Locale message.
1501 *
1502 * The type defined by this can be used in the global scope.
1503 *
1504 * @example
1505 * ```ts
1506 * // type.d.ts (`.d.ts` file at your app)
1507 * import { DefineLocaleMessage } from 'vue-i18n'
1508 *
1509 * declare module 'vue-i18n' {
1510 * export interface DefineLocaleMessage {
1511 * title: string
1512 * menu: {
1513 * login: string
1514 * }
1515 * }
1516 * }
1517 * ```
1518 *
1519 * @VueI18nGeneral
1520 */
1521export declare interface DefineLocaleMessage extends LocaleMessage<VueMessageType> {
1522}
1523
1524/**
1525 * The type definition of number format
1526 *
1527 * @remarks
1528 * The typealias is used to strictly define the type of the Number format.
1529 *
1530 * The type defined by this can be used in the global scope.
1531 *
1532 * @example
1533 * ```ts
1534 * // type.d.ts (`.d.ts` file at your app)
1535 * import { DefineNumberFormat } from 'vue-i18n'
1536 *
1537 * declare module 'vue-i18n' {
1538 * export interface DefineNumberFormat {
1539 * currency: {
1540 * style: 'currency'
1541 * currencyDisplay: 'symbol'
1542 * currency: string
1543 * }
1544 * }
1545 * }
1546 * ```
1547 *
1548 * @VueI18nGeneral
1549 */
1550export declare interface DefineNumberFormat extends IntlNumberFormat {
1551}
1552
1553export declare type Disposer = () => void;
1554
1555/**
1556 * Exported global composer instance
1557 *
1558 * @remarks
1559 * This interface is the [global composer](general#global) that is provided interface that is injected into each component with `app.config.globalProperties`.
1560 *
1561 * @VueI18nGeneral
1562 */
1563export declare interface ExportedGlobalComposer {
1564 /**
1565 * Locale
1566 *
1567 * @remarks
1568 * This property is proxy-like property for `Composer#locale`. About details, see the [Composer#locale](composition#locale)
1569 */
1570 locale: Locale;
1571 /**
1572 * Fallback locale
1573 *
1574 * @remarks
1575 * This property is proxy-like property for `Composer#fallbackLocale`. About details, see the [Composer#fallbackLocale](composition#fallbacklocale)
1576 */
1577 fallbackLocale: FallbackLocale;
1578 /**
1579 * Available locales
1580 *
1581 * @remarks
1582 * This property is proxy-like property for `Composer#availableLocales`. About details, see the [Composer#availableLocales](composition#availablelocales)
1583 */
1584 readonly availableLocales: Locale[];
1585}
1586export { FallbackLocale }
1587
1588/**
1589 * Formattable Props
1590 *
1591 * @remarks
1592 * The props used in DatetimeFormat, or NumberFormat component
1593 *
1594 * @VueI18nComponent
1595 */
1596export declare interface FormattableProps<Value, Format> extends BaseFormatProps {
1597 /**
1598 * @remarks
1599 * The value specified for the target component
1600 */
1601 value: Value;
1602 /**
1603 * @remarks
1604 * The format to use in the target component.
1605 *
1606 * Specify the format key string or the format as defined by the Intl API in ECMA 402.
1607 */
1608 format?: string | Format;
1609}
1610
1611export declare interface Formatter {
1612 interpolate(message: string, values: any, path: string): Array<any> | null;
1613}
1614
1615/**
1616 * I18n instance
1617 *
1618 * @remarks
1619 * The instance required for installation as the Vue plugin
1620 *
1621 * @VueI18nGeneral
1622 */
1623export declare interface I18n<Messages extends Record<string, unknown> = {}, DateTimeFormats extends Record<string, unknown> = {}, NumberFormats extends Record<string, unknown> = {}, OptionLocale = Locale, Legacy = boolean> {
1624 /**
1625 * Vue I18n API mode
1626 *
1627 * @remarks
1628 * If you specified `legacy: true` option in `createI18n`, return `legacy`, else `composition`
1629 *
1630 * @defaultValue `'legacy'`
1631 */
1632 readonly mode: I18nMode;
1633 /**
1634 * The property accessible to the global Composer instance or VueI18n instance
1635 *
1636 * @remarks
1637 * If the [I18n#mode](general#mode) is `'legacy'`, then you can access to a global {@link VueI18n} instance, else then [I18n#mode](general#mode) is `'composition' `, you can access to the global {@link Composer} instance.
1638 *
1639 * An instance of this property is **global scope***.
1640 */
1641 readonly global: Legacy extends true ? VueI18n<Messages, DateTimeFormats, NumberFormats, OptionLocale> : Legacy extends false ? Composer<Messages, DateTimeFormats, NumberFormats, OptionLocale> : unknown;
1642 /**
1643 * The property whether or not the Composition API is available
1644 *
1645 * @remarks
1646 * If you specified `allowComposition: true` option in Legacy API mode, return `true`, else `false`. else you use the Composition API mode, this property will always return `true`.
1647 */
1648 readonly allowComposition: boolean;
1649 /**
1650 * Install entry point
1651 *
1652 * @param app - A target Vue app instance
1653 * @param options - An install options
1654 */
1655 install(app: App, ...options: unknown[]): void;
1656 /**
1657 * Release global scope resource
1658 */
1659 dispose(): void;
1660}
1661
1662/**
1663 * I18n Additional Options
1664 *
1665 * @remarks
1666 * Specific options for {@link createI18n}
1667 *
1668 * @VueI18nGeneral
1669 */
1670export declare interface I18nAdditionalOptions {
1671 /**
1672 * Whether vue-i18n Legacy API mode use on your Vue App
1673 *
1674 * @remarks
1675 * The default is to use the Legacy API mode. If you want to use the Composition API mode, you need to set it to `false`.
1676 *
1677 * @VueI18nSee [Composition API](../guide/advanced/composition)
1678 *
1679 * @defaultValue `true`
1680 */
1681 legacy?: boolean;
1682 /**
1683 * Whether to inject global properties & functions into for each component.
1684 *
1685 * @remarks
1686 * If set to `true`, then properties and methods prefixed with `$` are injected into Vue Component.
1687 *
1688 * @VueI18nSee [Implicit with injected properties and functions](../guide/advanced/composition#implicit-with-injected-properties-and-functions)
1689 * @VueI18nSee [ComponentCustomProperties](injection#componentcustomproperties)
1690 *
1691 * @defaultValue `true`
1692 */
1693 globalInjection?: boolean;
1694 /**
1695 * Whether to allow the Composition API to be used in Legacy API mode.
1696 *
1697 * @remarks
1698 * If this option is enabled, you can use {@link useI18n} in Legacy API mode. This option is supported to support the migration from Legacy API mode to Composition API mode.
1699 *
1700 * @VueI18nWarning Note that the Composition API made available with this option doesn't work on SSR.
1701 * @VueI18nSee [Composition API](../guide/advanced/composition)
1702 *
1703 * @defaultValue `false`
1704 */
1705 allowComposition?: boolean;
1706}
1707
1708export declare const I18nD: new () => {
1709 $props: VNodeProps & DatetimeFormatProps & BaseFormatProps;
1710};
1711
1712/**
1713 * Injection key for {@link useI18n}
1714 *
1715 * @remarks
1716 * The global injection key for I18n instances with `useI18n`. this injection key is used in Web Components.
1717 * Specify the i18n instance created by {@link createI18n} together with `provide` function.
1718 *
1719 * @VueI18nGeneral
1720 */
1721export declare const I18nInjectionKey: InjectionKey<I18n> | string;
1722
1723/**
1724 * Vue I18n API mode
1725 *
1726 * @VueI18nSee [I18n#mode](general#mode)
1727 *
1728 * @VueI18nGeneral
1729 */
1730export declare type I18nMode = 'legacy' | 'composition';
1731
1732export declare const I18nN: new () => {
1733 $props: VNodeProps & NumberFormatProps & BaseFormatProps;
1734};
1735
1736/**
1737 * I18n Options for `createI18n`
1738 *
1739 * @remarks
1740 * `I18nOptions` is inherited {@link I18nAdditionalOptions}, {@link ComposerOptions} and {@link VueI18nOptions},
1741 * so you can specify these options.
1742 *
1743 * @VueI18nGeneral
1744 */
1745export declare type I18nOptions<Schema extends {
1746 message?: unknown;
1747 datetime?: unknown;
1748 number?: unknown;
1749} = {
1750 message: DefaultLocaleMessageSchema;
1751 datetime: DefaultDateTimeFormatSchema;
1752 number: DefaultNumberFormatSchema;
1753}, Locales extends {
1754 messages: unknown;
1755 datetimeFormats: unknown;
1756 numberFormats: unknown;
1757} | string = Locale, Options extends ComposerOptions<Schema, Locales> | VueI18nOptions<Schema, Locales> = ComposerOptions<Schema, Locales> | VueI18nOptions<Schema, Locales>> = I18nAdditionalOptions & Options;
1758
1759/**
1760 * Vue I18n plugin options
1761 *
1762 * @remarks
1763 * An options specified when installing Vue I18n as Vue plugin with using `app.use`.
1764 *
1765 * @VueI18nGeneral
1766 */
1767export declare interface I18nPluginOptions {
1768 /**
1769 * Whether to use the tag name `i18n` for Translation Component
1770 *
1771 * @remarks
1772 * This option is used for compatibility with Vue I18n v8.x.
1773 *
1774 * If you can't migrate right away, you can temporarily enable this option, and you can work Translation Component.
1775 *
1776 * @defaultValue `false`
1777 */
1778 useI18nComponentName?: boolean;
1779 /**
1780 * Whether to globally install the components that is offered by Vue I18n
1781 *
1782 * @remarks
1783 * If this option is enabled, the components will be installed globally at `app.use` time.
1784 *
1785 * If you want to install manually in the `import` syntax, you can set it to `false` to install when needed.
1786 *
1787 * @defaultValue `true`
1788 */
1789 globalInstall?: boolean;
1790}
1791
1792/**
1793 * I18n Scope
1794 *
1795 * @VueI18nSee [ComposerAdditionalOptions#useScope](composition#usescope)
1796 * @VueI18nSee [useI18n](composition#usei18n)
1797 *
1798 * @VueI18nGeneral
1799 */
1800export declare type I18nScope = 'local' | 'parent' | 'global';
1801
1802export declare const I18nT: new () => {
1803 $props: VNodeProps & TranslationProps;
1804};
1805export { IntlDateTimeFormat }
1806export { IntlDateTimeFormats }
1807export { IntlFormatMatcher }
1808export { IntlLocaleMatcher }
1809export { IntlNumberFormat }
1810export { IntlNumberFormats }
1811export { IsEmptyObject }
1812export { IsNever }
1813export { LinkedModifiers }
1814export { Locale }
1815export { LocaleMessageDictionary }
1816
1817/** @VueI18nLegacy */
1818export declare type LocaleMessageObject<Message = string> = LocaleMessageDictionary<Message>;
1819export { LocaleMessages }
1820export { LocaleMessageType }
1821export { LocaleMessageValue }
1822export { MessageCompiler }
1823export { MessageCompilerContext }
1824export { MessageContext }
1825export { MessageFunction }
1826export { MessageFunctions }
1827export { MessageResolver }
1828
1829/** @VueI18nComposition */
1830export declare type MissingHandler = (locale: Locale, key: Path, instance?: ComponentInternalInstance, type?: string) => string | void;
1831export { NamedValue }
1832
1833/**
1834 * Number Format Component
1835 *
1836 * @remarks
1837 * See the following items for property about details
1838 *
1839 * @VueI18nSee [FormattableProps](component#formattableprops)
1840 * @VueI18nSee [BaseFormatProps](component#baseformatprops)
1841 * @VueI18nSee [Custom Formatting](../guide/essentials/number#custom-formatting)
1842 *
1843 * @VueI18nDanger
1844 * Not supported IE, due to no support `Intl.NumberFormat#formatToParts` in [IE](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/formatToParts)
1845 *
1846 * If you want to use it, you need to use [polyfill](https://github.com/formatjs/formatjs/tree/main/packages/intl-numberformat)
1847 *
1848 * @VueI18nComponent
1849 */
1850export declare const NumberFormat: new () => {
1851 $props: VNodeProps & NumberFormatProps & BaseFormatProps;
1852};
1853
1854/**
1855 * NumberFormat Component Props
1856 *
1857 * @VueI18nComponent
1858 */
1859export declare type NumberFormatProps = FormattableProps<number, Intl.NumberFormatOptions>;
1860
1861/** @VueI18nLegacy */
1862export declare type NumberFormatResult = string;
1863export { NumberOptions }
1864export { Path }
1865export { PathValue }
1866export { PickupFormatPathKeys }
1867export { PickupKeys }
1868export { PickupPaths }
1869export { PluralizationRule }
1870
1871export declare type PluralizationRulesMap = {
1872 [locale: string]: PluralizationRule;
1873};
1874export { PostTranslationHandler }
1875export { RemovedIndexResources }
1876export { TranslateOptions }
1877
1878/** @VueI18nLegacy */
1879export declare type TranslateResult = string;
1880
1881/**
1882 * Translation Component
1883 *
1884 * @remarks
1885 * See the following items for property about details
1886 *
1887 * @VueI18nSee [TranslationProps](component#translationprops)
1888 * @VueI18nSee [BaseFormatProps](component#baseformatprops)
1889 * @VueI18nSee [Component Interpolation](../guide/advanced/component)
1890 *
1891 * @example
1892 * ```html
1893 * <div id="app">
1894 * <!-- ... -->
1895 * <i18n keypath="term" tag="label" for="tos">
1896 * <a :href="url" target="_blank">{{ $t('tos') }}</a>
1897 * </i18n>
1898 * <!-- ... -->
1899 * </div>
1900 * ```
1901 * ```js
1902 * import { createApp } from 'vue'
1903 * import { createI18n } from 'vue-i18n'
1904 *
1905 * const messages = {
1906 * en: {
1907 * tos: 'Term of Service',
1908 * term: 'I accept xxx {0}.'
1909 * },
1910 * ja: {
1911 * tos: '利用規約',
1912 * term: '私は xxx の{0}に同意します。'
1913 * }
1914 * }
1915 *
1916 * const i18n = createI18n({
1917 * locale: 'en',
1918 * messages
1919 * })
1920 *
1921 * const app = createApp({
1922 * data: {
1923 * url: '/term'
1924 * }
1925 * }).use(i18n).mount('#app')
1926 * ```
1927 *
1928 * @VueI18nComponent
1929 */
1930export declare const Translation: new () => {
1931 $props: VNodeProps & TranslationProps;
1932};
1933
1934/**
1935 * Translation Directive (`v-t`)
1936 *
1937 * @remarks
1938 * Update the element `textContent` that localized with locale messages.
1939 *
1940 * You can use string syntax or object syntax.
1941 *
1942 * String syntax can be specified as a keypath of locale messages.
1943 *
1944 * If you can be used object syntax, you need to specify as the object key the following params
1945 *
1946 * ```
1947 * - path: required, key of locale messages
1948 * - locale: optional, locale
1949 * - args: optional, for list or named formatting
1950 * ```
1951 *
1952 * @example
1953 * ```html
1954 * <!-- string syntax: literal -->
1955 * <p v-t="'foo.bar'"></p>
1956 *
1957 * <!-- string syntax: binding via data or computed props -->
1958 * <p v-t="msg"></p>
1959 *
1960 * <!-- object syntax: literal -->
1961 * <p v-t="{ path: 'hi', locale: 'ja', args: { name: 'kazupon' } }"></p>
1962 *
1963 * <!-- object syntax: binding via data or computed props -->
1964 * <p v-t="{ path: greeting, args: { name: fullName } }"></p>
1965 * ```
1966 *
1967 * @VueI18nDirective
1968 */
1969export declare type TranslationDirective<T = HTMLElement> = ObjectDirective<T>;
1970
1971/**
1972 * Translation Component Props
1973 *
1974 * @VueI18nComponent
1975 */
1976export declare interface TranslationProps extends BaseFormatProps {
1977 /**
1978 * @remarks
1979 * The locale message key can be specified prop
1980 */
1981 keypath: string;
1982 /**
1983 * @remarks
1984 * The Plural Choosing the message number prop
1985 */
1986 plural?: number | string;
1987}
1988
1989export declare function useI18n<Options extends UseI18nOptions = UseI18nOptions>(options?: Options): Composer<NonNullable<Options['messages']>, NonNullable<Options['datetimeFormats']>, NonNullable<Options['numberFormats']>, Options['locale'] extends unknown ? string : Options['locale']>;
1990
1991/**
1992 * Use Composition API for Vue I18n
1993 *
1994 * @param options - An options, see {@link UseI18nOptions}
1995 *
1996 * @typeParam Schema - The i18n resources (messages, datetimeFormats, numberFormats) schema, default {@link LocaleMessage}
1997 * @typeParam Locales - The locales of i18n resource schema, default `en-US`
1998 *
1999 * @returns {@link Composer} instance
2000 *
2001 * @remarks
2002 * This function is mainly used by `setup`.
2003 *
2004 * If options are specified, Composer instance is created for each component and you can be localized on the component.
2005 *
2006 * If options are not specified, you can be localized using the global Composer.
2007 *
2008 * @example
2009 * case: Component resource base localization
2010 * ```html
2011 * <template>
2012 * <form>
2013 * <label>{{ t('language') }}</label>
2014 * <select v-model="locale">
2015 * <option value="en">en</option>
2016 * <option value="ja">ja</option>
2017 * </select>
2018 * </form>
2019 * <p>message: {{ t('hello') }}</p>
2020 * </template>
2021 *
2022 * <script>
2023 * import { useI18n } from 'vue-i18n'
2024 *
2025 * export default {
2026 * setup() {
2027 * const { t, locale } = useI18n({
2028 * locale: 'ja',
2029 * messages: {
2030 * en: { ... },
2031 * ja: { ... }
2032 * }
2033 * })
2034 * // Something to do ...
2035 *
2036 * return { ..., t, locale }
2037 * }
2038 * }
2039 * </script>
2040 * ```
2041 *
2042 * @VueI18nComposition
2043 */
2044export declare function useI18n<Schema = DefaultLocaleMessageSchema, Locales = 'en-US', Options extends UseI18nOptions<SchemaParams<Schema, VueMessageType>, LocaleParams<Locales>> = UseI18nOptions<SchemaParams<Schema, VueMessageType>, LocaleParams<Locales>>>(options?: Options): Composer<NonNullable<Options['messages']>, NonNullable<Options['datetimeFormats']>, NonNullable<Options['numberFormats']>, Options['locale'] extends unknown ? string : Options['locale']>;
2045
2046/**
2047 * I18n Options for `useI18n`
2048 *
2049 * @remarks
2050 * `UseI18nOptions` is inherited {@link ComposerAdditionalOptions} and {@link ComposerOptions}, so you can specify these options.
2051 *
2052 * @VueI18nSee [useI18n](composition#usei18n)
2053 *
2054 * @VueI18nComposition
2055 */
2056export declare type UseI18nOptions<Schema extends {
2057 message?: unknown;
2058 datetime?: unknown;
2059 number?: unknown;
2060} = {
2061 message: DefaultLocaleMessageSchema;
2062 datetime: DefaultDateTimeFormatSchema;
2063 number: DefaultNumberFormatSchema;
2064}, Locales extends {
2065 messages: unknown;
2066 datetimeFormats: unknown;
2067 numberFormats: unknown;
2068} | string = Locale, Options extends ComposerOptions<Schema, Locales> = ComposerOptions<Schema, Locales>> = ComposerAdditionalOptions & Options;
2069
2070/**
2071 * Vue I18n Version
2072 *
2073 * @remarks
2074 * Semver format. Same format as the package.json `version` field.
2075 *
2076 * @VueI18nGeneral
2077 */
2078export declare const VERSION: string;
2079
2080export declare function vTDirective(i18n: I18n): TranslationDirective<HTMLElement>;
2081
2082export declare type VTDirectiveValue = {
2083 path: string;
2084 locale?: Locale;
2085 args?: NamedValue;
2086 choice?: number;
2087 plural?: number;
2088};
2089
2090/**
2091 * VueI18n legacy interfaces
2092 *
2093 * @remarks
2094 * This interface is compatible with interface of `VueI18n` class (offered with Vue I18n v8.x).
2095 *
2096 * @VueI18nLegacy
2097 */
2098export declare interface VueI18n<Messages extends Record<string, any> = {}, DateTimeFormats extends Record<string, any> = {}, NumberFormats extends Record<string, any> = {}, OptionLocale = Locale, ResourceLocales = PickupLocales<NonNullable<Messages>> | PickupLocales<NonNullable<DateTimeFormats>> | PickupLocales<NonNullable<NumberFormats>>, Locales = OptionLocale extends string ? [ResourceLocales] extends [never] ? Locale : ResourceLocales : OptionLocale | ResourceLocales, Composition extends Composer<Messages, DateTimeFormats, NumberFormats, OptionLocale> = Composer<Messages, DateTimeFormats, NumberFormats, OptionLocale>> {
2099 /**
2100 * @remarks
2101 * Instance ID.
2102 */
2103 id: number;
2104 /**
2105 * @remarks
2106 * The current locale this VueI18n instance is using.
2107 *
2108 * If the locale contains a territory and a dialect, this locale contains an implicit fallback.
2109 *
2110 * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
2111 */
2112 locale: Locales;
2113 /**
2114 * @remarks
2115 * The current fallback locales this VueI18n instance is using.
2116 *
2117 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
2118 */
2119 fallbackLocale: FallbackLocales<Locales>;
2120 /**
2121 * @remarks
2122 * The list of available locales in `messages` in lexical order.
2123 */
2124 readonly availableLocales: Composition['availableLocales'];
2125 /**
2126 * @remarks
2127 * The locale messages of localization.
2128 *
2129 * @VueI18nSee [Getting Started](../guide/essentials/started)
2130 */
2131 readonly messages: {
2132 [K in keyof Messages]: Messages[K];
2133 };
2134 /**
2135 * @remarks
2136 * The datetime formats of localization.
2137 *
2138 * @VueI18nSee [Datetime Formatting](../guide/essentials/datetime)
2139 */
2140 readonly datetimeFormats: {
2141 [K in keyof DateTimeFormats]: DateTimeFormats[K];
2142 };
2143 /**
2144 * @remarks
2145 * The number formats of localization.
2146 *
2147 * @VueI18nSee [Number Formatting](../guide/essentials/number)
2148 */
2149 readonly numberFormats: {
2150 [K in keyof NumberFormats]: NumberFormats[K];
2151 };
2152 /**
2153 * @remarks
2154 * Custom Modifiers for linked messages.
2155 *
2156 * @VueI18nSee [Custom Modifiers](../guide/essentials/syntax#custom-modifiers)
2157 */
2158 readonly modifiers: Composition['modifiers'];
2159 /**
2160 * @remarks
2161 * The formatter that implemented with Formatter interface.
2162 *
2163 * @deprecated See the [here](../guide/migration/breaking#remove-custom-formatter)
2164 */
2165 formatter: Formatter;
2166 /**
2167 * @remarks
2168 * A handler for localization missing.
2169 */
2170 missing: MissingHandler | null;
2171 /**
2172 * @remarks
2173 * A handler for post processing of translation.
2174 */
2175 postTranslation: PostTranslationHandler<VueMessageType> | null;
2176 /**
2177 * @remarks
2178 * Whether suppress warnings outputted when localization fails.
2179 *
2180 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
2181 */
2182 silentTranslationWarn: Composition['missingWarn'];
2183 /**
2184 * @remarks
2185 * Whether suppress fallback warnings when localization fails.
2186 */
2187 silentFallbackWarn: Composition['fallbackWarn'];
2188 /**
2189 * @remarks
2190 * Whether suppress warnings when falling back to either `fallbackLocale` or root.
2191 *
2192 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
2193 */
2194 formatFallbackMessages: Composition['fallbackFormat'];
2195 /**
2196 * @remarks
2197 * Whether synchronize the root level locale to the component localization locale.
2198 *
2199 * @VueI18nSee [Local Scope](../guide/essentials/scope#local-scope-2)
2200 */
2201 sync: Composition['inheritLocale'];
2202 /**
2203 * @remarks
2204 * Whether to allow the use locale messages of HTML formatting.
2205 *
2206 * If you set `warn` or` error`, will check the locale messages on the VueI18n instance.
2207 *
2208 * If you are specified `warn`, a warning will be output at console.
2209 *
2210 * If you are specified `error` will occurred an Error.
2211 *
2212 * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
2213 * @VueI18nSee [Change `warnHtmlInMessage` option default value](../guide/migration/breaking#change-warnhtmlinmessage-option-default-value)
2214 */
2215 warnHtmlInMessage: WarnHtmlInMessageLevel;
2216 /**
2217 * @remarks
2218 * Whether interpolation parameters are escaped before the message is translated.
2219 *
2220 * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
2221 */
2222 escapeParameterHtml: Composition['escapeParameter'];
2223 /**
2224 * @remarks
2225 * Whether `v-t` directive's element should preserve `textContent` after directive is unbinded.
2226 *
2227 * @VueI18nSee [Custom Directive](../guide/advanced/directive)
2228 * @VueI18nSee [Remove preserveDirectiveContent option](../guide/migration/breaking#remove-preservedirectivecontent-option)
2229 *
2230 * @deprecated The `v-t` directive for Vue 3 now preserves the default content. Therefore, this option and its properties have been removed from the VueI18n instance.
2231 */
2232 preserveDirectiveContent: boolean;
2233 /**
2234 * A set of rules for word pluralization
2235 *
2236 * @VueI18nSee [Custom Pluralization](../guide/essentials/pluralization#custom-pluralization)
2237 */
2238 pluralizationRules: Composition['pluralRules'];
2239 /**
2240 * Locale message translation
2241 *
2242 * @remarks
2243 * About details functions, See the {@link VueI18nTranslation}
2244 */
2245 t: VueI18nTranslation<Messages, Locales, RemoveIndexSignature<{
2246 [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
2247 }>>;
2248 /**
2249 * Resolve locale message translation
2250 *
2251 * @remarks
2252 * About details functions, See the {@link VueI18nResolveLocaleMessageTranslation}
2253 */
2254 rt: VueI18nResolveLocaleMessageTranslation<Locales>;
2255 /**
2256 * Locale message pluralization
2257 *
2258 * @remarks
2259 * About details functions, See the {@link VueI18nTranslationChoice}
2260 */
2261 tc: VueI18nTranslationChoice<Messages, Locales, RemoveIndexSignature<{
2262 [K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
2263 }>>;
2264 /**
2265 * Translation locale message exist
2266 *
2267 * @remarks
2268 * whether do exist locale message on VueI18n instance [messages](legacy#messages).
2269 *
2270 * If you specified `locale`, check the locale messages of `locale`.
2271 *
2272 * @param key - A target locale message key
2273 * @param locale - A target locale
2274 *
2275 * @returns If found locale message, `true`, else `false`
2276 */
2277 te<Str extends string, Key extends PickupKeys<Messages> = PickupKeys<Messages>>(key: Str | Key, locale?: Locales): boolean;
2278 /**
2279 * Locale messages getter
2280 *
2281 * @remarks
2282 * If [i18n component options](injection#i18n) is specified, it’s get in preferentially local scope locale messages than global scope locale messages.
2283 *
2284 * If [i18n component options](injection#i18n) isn't specified, it’s get with global scope locale messages.
2285 *
2286 * Based on the current `locale`, locale messages will be returned from Composer instance messages.
2287 *
2288 * If you change the `locale`, the locale messages returned will also correspond to the locale.
2289 *
2290 * If there are no locale messages for the given `key` in the composer instance messages, they will be returned with [fallbacking](../guide/essentials/fallback).
2291 *
2292 * @VueI18nWarning
2293 * You need to use `rt` for the locale message returned by `tm`. see the [rt](legacy#rt-message) details.
2294 *
2295 * @example
2296 * template:
2297 * ```html
2298 * <div class="container">
2299 * <template v-for="content in $tm('contents')">
2300 * <h2>{{ $rt(content.title) }}</h2>
2301 * <p v-for="paragraph in content.paragraphs">
2302 * {{ $rt(paragraph) }}
2303 * </p>
2304 * </template>
2305 * </div>
2306 * ```
2307 *
2308 * ```js
2309 * import { createI18n } from 'vue-i18n'
2310 *
2311 * const i18n = createI18n({
2312 * messages: {
2313 * en: {
2314 * contents: [
2315 * {
2316 * title: 'Title1',
2317 * // ...
2318 * paragraphs: [
2319 * // ...
2320 * ]
2321 * }
2322 * ]
2323 * }
2324 * }
2325 * // ...
2326 * })
2327 * ```
2328 * @param key - A target locale message key
2329 *
2330 * @return Locale messages
2331 */
2332 tm: Composition['tm'];
2333 /**
2334 * Get locale message
2335 *
2336 * @remarks
2337 * get locale message from VueI18n instance [messages](legacy#messages).
2338 *
2339 * @param locale - A target locale
2340 *
2341 * @returns Locale messages
2342 */
2343 getLocaleMessage: Composition['getLocaleMessage'];
2344 /**
2345 * Set locale message
2346 *
2347 * @remarks
2348 * Set locale message to VueI18n instance [messages](legacy#messages).
2349 *
2350 * @param locale - A target locale
2351 * @param message - A message
2352 */
2353 setLocaleMessage: Composition['setLocaleMessage'];
2354 /**
2355 * Merge locale message
2356 *
2357 * @remarks
2358 * Merge locale message to VueI18n instance [messages](legacy#messages).
2359 *
2360 * @param locale - A target locale
2361 * @param message - A message
2362 */
2363 mergeLocaleMessage: Composition['mergeLocaleMessage'];
2364 /**
2365 * Datetime formatting
2366 *
2367 * @remarks
2368 * About details functions, See the {@link VueI18nDateTimeFormatting}
2369 */
2370 d: VueI18nDateTimeFormatting<DateTimeFormats, Locales, RemoveIndexSignature<{
2371 [K in keyof DefineDateTimeFormat]: DefineDateTimeFormat[K];
2372 }>>;
2373 /**
2374 * Get datetime format
2375 *
2376 * @remarks
2377 * get datetime format from VueI18n instance [datetimeFormats](legacy#datetimeformats).
2378 *
2379 * @param locale - A target locale
2380 *
2381 * @returns Datetime format
2382 */
2383 getDateTimeFormat: Composition['getDateTimeFormat'];
2384 /**
2385 * Set datetime format
2386 *
2387 * @remarks
2388 * Set datetime format to VueI18n instance [datetimeFormats](legacy#datetimeformats).
2389 *
2390 * @param locale - A target locale
2391 * @param format - A target datetime format
2392 */
2393 setDateTimeFormat: Composition['setDateTimeFormat'];
2394 /**
2395 * Merge datetime format
2396 *
2397 * @remarks
2398 * Merge datetime format to VueI18n instance [datetimeFormats](legacy#datetimeformats).
2399 *
2400 * @param locale - A target locale
2401 * @param format - A target datetime format
2402 */
2403 mergeDateTimeFormat: Composition['mergeDateTimeFormat'];
2404 /**
2405 * Number Formatting
2406 *
2407 * @remarks
2408 * About details functions, See the {@link VueI18nNumberFormatting}
2409 */
2410 n: VueI18nNumberFormatting<NumberFormats, Locales, RemoveIndexSignature<{
2411 [K in keyof DefineNumberFormat]: DefineNumberFormat[K];
2412 }>>;
2413 /**
2414 * Get number format
2415 *
2416 * @remarks
2417 * get number format from VueI18n instance [numberFormats](legacy#numberFormats).
2418 *
2419 * @param locale - A target locale
2420 *
2421 * @returns Number format
2422 */
2423 getNumberFormat: Composition['getNumberFormat'];
2424 /**
2425 * Set number format
2426 *
2427 * @remarks
2428 * Set number format to VueI18n instance [numberFormats](legacy#numberFormats).
2429 *
2430 * @param locale - A target locale
2431 * @param format - A target number format
2432 */
2433 setNumberFormat: Composition['setNumberFormat'];
2434 /**
2435 * Merge number format
2436 *
2437 * @remarks
2438 * Merge number format to VueI18n instance [numberFormats](legacy#numberFormats).
2439 *
2440 * @param locale - A target locale
2441 * @param format - A target number format
2442 */
2443 mergeNumberFormat: Composition['mergeNumberFormat'];
2444 /**
2445 * Get choice index
2446 *
2447 * @remarks
2448 * Get pluralization index for current pluralizing number and a given amount of choices.
2449 *
2450 * @deprecated Use `pluralizationRules` option instead of `getChoiceIndex`.
2451 */
2452 getChoiceIndex: (choice: Choice, choicesLength: number) => number;
2453}
2454
2455/**
2456 * Datetime formatting functions for VueI18n legacy interfaces
2457 *
2458 * @remarks
2459 * This is the interface for {@link VueI18n}
2460 *
2461 * @VueI18nLegacy
2462 */
2463export declare interface VueI18nDateTimeFormatting<DateTimeFormats extends Record<string, any> = {}, Locales = 'en-US', DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>, C = IsEmptyObject<DefinedDateTimeFormat> extends false ? PickupFormatPathKeys<{
2464 [K in keyof DefinedDateTimeFormat]: DefinedDateTimeFormat[K];
2465}> : never, M = IsEmptyObject<DateTimeFormats> extends false ? PickupFormatKeys<DateTimeFormats> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
2466 /**
2467 * Datetime formatting
2468 *
2469 * @remarks
2470 * If this is used in a reactive context, it will re-evaluate once the locale changes.
2471 *
2472 * If [i18n component options](injection#i18n) is specified, it’s formatted in preferentially local scope datetime formats than global scope locale messages.
2473 *
2474 * If [i18n component options](injection#i18n) isn't specified, it’s formatted with global scope datetime formats.
2475 *
2476 * @param value - A value, timestamp number or `Date` instance
2477 *
2478 * @returns Formatted value
2479 *
2480 * @VueI18nSee [Datetime formatting](../guide/essentials/datetime)
2481 */
2482 (value: number | Date): DateTimeFormatResult;
2483 /**
2484 * Datetime formatting
2485 *
2486 * @remarks
2487 * Overloaded `d`. About details, see the [call signature](legacy#value-number-date-datetimeformatresult) details.
2488 *
2489 * @param value - A value, timestamp number or `Date` instance
2490 * @param key - A key of datetime formats
2491 *
2492 * @returns Formatted value
2493 */
2494 <Value extends number | Date = number, Key extends string = string>(value: Value, key: Key | ResourceKeys): DateTimeFormatResult;
2495 /**
2496 * Datetime formatting
2497 *
2498 * @remarks
2499 * Overloaded `d`. About details, see the [call signature](legacy#value-number-date-datetimeformatresult) details.
2500 *
2501 * @param value - A value, timestamp number or `Date` instance
2502 * @param key - A key of datetime formats
2503 * @param locale - A locale, it will be used over than global scope or local scope.
2504 *
2505 * @returns Formatted value
2506 */
2507 <Value extends number | Date = number, Key extends string = string>(value: Value, key: Key | ResourceKeys, locale: Locales): DateTimeFormatResult;
2508 /**
2509 * Datetime formatting
2510 *
2511 * @remarks
2512 * Overloaded `d`. About details, see the [call signature](legacy#value-number-date-datetimeformatresult) details.
2513 *
2514 * @param value - A value, timestamp number or `Date` instance
2515 * @param args - An argument values
2516 *
2517 * @returns Formatted value
2518 */
2519 (value: number | Date, args: {
2520 [key: string]: string | boolean | number;
2521 }): DateTimeFormatResult;
2522}
2523
2524export declare type VueI18nExtender = (vueI18n: VueI18n) => Disposer | undefined;
2525
2526/**
2527 * Number formatting functions for VueI18n legacy interfaces
2528 *
2529 * @remarks
2530 * This is the interface for {@link VueI18n}
2531 *
2532 * @VueI18nLegacy
2533 */
2534export declare interface VueI18nNumberFormatting<NumberFormats extends Record<string, any> = {}, Locales = 'en-US', DefinedNumberFormat extends RemovedIndexResources<DefineNumberFormat> = RemovedIndexResources<DefineNumberFormat>, C = IsEmptyObject<DefinedNumberFormat> extends false ? PickupFormatPathKeys<{
2535 [K in keyof DefinedNumberFormat]: DefinedNumberFormat[K];
2536}> : never, M = IsEmptyObject<NumberFormats> extends false ? PickupFormatKeys<NumberFormats> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
2537 /**
2538 * Number formatting
2539 *
2540 * @remarks
2541 * If this is used in a reactive context, it will re-evaluate once the locale changes.
2542 *
2543 * If [i18n component options](injection#i18n) is specified, it’s formatted in preferentially local scope number formats than global scope locale messages.
2544 *
2545 * If [i18n component options](injection#i18n) isn't specified, it’s formatted with global scope number formats.
2546 *
2547 * @param value - A number value
2548 *
2549 * @returns Formatted value
2550 *
2551 * @VueI18nSee [Number formatting](../guide/essentials/number)
2552 */
2553 (value: number): NumberFormatResult;
2554 /**
2555 * Number formatting
2556 *
2557 * @remarks
2558 * Overloaded `n`. About details, see the [call signature](legacy#value-number-numberformatresult) details.
2559 *
2560 * @param value - A number value
2561 * @param key - A key of number formats
2562 *
2563 * @returns Formatted value
2564 */
2565 <Key extends string = string>(value: number, key: Key | ResourceKeys): NumberFormatResult;
2566 /**
2567 * Number formatting
2568 *
2569 * @remarks
2570 * Overloaded `n`. About details, see the [call signature](legacy#value-number-numberformatresult) details.
2571 *
2572 * @param value - A number value
2573 * @param key - A key of number formats
2574 * @param locale - A locale, it will be used over than global scope or local scope.
2575 *
2576 * @returns Formatted value
2577 */
2578 <Key extends string = string>(value: number, key: Key | ResourceKeys, locale: Locales): NumberFormatResult;
2579 /**
2580 * Number formatting
2581 *
2582 * @remarks
2583 * Overloaded `n`. About details, see the [call signature](legacy#value-number-numberformatresult) details.
2584 *
2585 * @param value - A number value
2586 * @param args - An argument values
2587 *
2588 * @returns Formatted value
2589 */
2590 (value: number, args: {
2591 [key: string]: string | boolean | number;
2592 }): NumberFormatResult;
2593}
2594
2595/**
2596 * VueI18n Options
2597 *
2598 * @remarks
2599 * This option is compatible with `VueI18n` class constructor options (offered with Vue I18n v8.x)
2600 *
2601 * @VueI18nLegacy
2602 */
2603export declare interface VueI18nOptions<Schema extends {
2604 message?: unknown;
2605 datetime?: unknown;
2606 number?: unknown;
2607} = {
2608 message: DefaultLocaleMessageSchema;
2609 datetime: DefaultDateTimeFormatSchema;
2610 number: DefaultNumberFormatSchema;
2611}, Locales extends {
2612 messages: unknown;
2613 datetimeFormats: unknown;
2614 numberFormats: unknown;
2615} | string = Locale, Options extends ComposerOptions<Schema, Locales> = ComposerOptions<Schema, Locales>> {
2616 /**
2617 * @remarks
2618 * The locale of localization.
2619 *
2620 * If the locale contains a territory and a dialect, this locale contains an implicit fallback.
2621 *
2622 * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
2623 *
2624 * @defaultValue `'en-US'`
2625 */
2626 locale?: Options['locale'];
2627 /**
2628 * @remarks
2629 * The locale of fallback localization.
2630 *
2631 * For more complex fallback definitions see fallback.
2632 *
2633 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
2634 *
2635 * @defaultValue The default `'en-US'` for the `locale` if it's not specified, or it's `locale` value
2636 */
2637 fallbackLocale?: Options['fallbackLocale'];
2638 /**
2639 * @remarks
2640 * The locale messages of localization.
2641 *
2642 * @VueI18nSee [Getting Started](../guide/essentials/started)
2643 *
2644 * @defaultValue `{}`
2645 */
2646 messages?: Options['messages'];
2647 /**
2648 * @remarks
2649 * Allow use flat json messages or not
2650 *
2651 * @defaultValue `false`
2652 */
2653 flatJson?: Options['flatJson'];
2654 /**
2655 * @remarks
2656 * The datetime formats of localization.
2657 *
2658 * @VueI18nSee [Datetime Formatting](../guide/essentials/datetime)
2659 *
2660 * @defaultValue `{}`
2661 */
2662 datetimeFormats?: Options['datetimeFormats'];
2663 /**
2664 * @remarks
2665 * The number formats of localization.
2666 *
2667 * @VueI18nSee [Number Formatting](../guide/essentials/number)
2668 *
2669 * @defaultValue `{}`
2670 */
2671 numberFormats?: Options['numberFormats'];
2672 /**
2673 * @remarks
2674 * The list of available locales in messages in lexical order.
2675 *
2676 * @defaultValue `[]`
2677 */
2678 availableLocales?: Locale[];
2679 /**
2680 * @remarks
2681 * Custom Modifiers for linked messages.
2682 *
2683 * @VueI18nSee [Custom Modifiers](../guide/essentials/syntax#custom-modifiers)
2684 */
2685 modifiers?: Options['modifiers'];
2686 /**
2687 * @remarks
2688 * The formatter that implemented with Formatter interface.
2689 *
2690 * @deprecated See the [here](../guide/migration/breaking#remove-custom-formatter)
2691 */
2692 formatter?: Formatter;
2693 /**
2694 * @remarks
2695 * A handler for localization missing.
2696 *
2697 * The handler gets called with the localization target locale, localization path key, the Vue instance and values.
2698 *
2699 * If missing handler is assigned, and occurred localization missing, it's not warned.
2700 *
2701 * @defaultValue `null`
2702 */
2703 missing?: Options['missing'];
2704 /**
2705 * @remarks
2706 * In the component localization, whether to fall back to root level (global scope) localization when localization fails.
2707 *
2708 * If `false`, it's not fallback to root.
2709 *
2710 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
2711 *
2712 * @defaultValue `true`
2713 */
2714 fallbackRoot?: Options['fallbackRoot'];
2715 /**
2716 * @remarks
2717 * Whether suppress warnings outputted when localization fails.
2718 *
2719 * If `true`, suppress localization fail warnings.
2720 *
2721 * If you use regular expression, you can suppress localization fail warnings that it match with translation key (e.g. `t`).
2722 *
2723 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
2724 *
2725 * @defaultValue `false`
2726 */
2727 silentTranslationWarn?: Options['missingWarn'];
2728 /**
2729 * @remarks
2730 * Whether do template interpolation on translation keys when your language lacks a translation for a key.
2731 *
2732 * If `true`, skip writing templates for your "base" language; the keys are your templates.
2733 *
2734 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
2735 *
2736 * @defaultValue `false`
2737 */
2738 silentFallbackWarn?: Options['fallbackWarn'];
2739 /**
2740 * @remarks
2741 * Whether suppress warnings when falling back to either `fallbackLocale` or root.
2742 *
2743 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
2744 *
2745 * @defaultValue `false`
2746 */
2747 formatFallbackMessages?: Options['fallbackFormat'];
2748 /**
2749 * @remarks
2750 * Whether `v-t` directive's element should preserve `textContent` after directive is unbinded.
2751 *
2752 * @VueI18nSee [Custom Directive](../guide/advanced/directive)
2753 * @VueI18nSee [Remove `preserveDirectiveContent` option](../guide/migration/breaking#remove-preservedirectivecontent-option)
2754 *
2755 * @defaultValue `false`
2756 *
2757 * @deprecated The `v-t` directive for Vue 3 now preserves the default content. Therefore, this option and its properties have been removed from the VueI18n instance.
2758 */
2759 preserveDirectiveContent?: boolean;
2760 /**
2761 * @remarks
2762 * Whether to allow the use locale messages of HTML formatting.
2763 *
2764 * See the warnHtmlInMessage property.
2765 *
2766 * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
2767 * @VueI18nSee [Change `warnHtmlInMessage` option default value](../guide/migration/breaking#change-warnhtmlinmessage-option-default-value)
2768 *
2769 * @defaultValue `'off'`
2770 */
2771 warnHtmlInMessage?: WarnHtmlInMessageLevel;
2772 /**
2773 * @remarks
2774 * If `escapeParameterHtml` is configured as true then interpolation parameters are escaped before the message is translated.
2775 *
2776 * This is useful when translation output is used in `v-html` and the translation resource contains html markup (e.g. <b> around a user provided value).
2777 *
2778 * This usage pattern mostly occurs when passing precomputed text strings into UI components.
2779 *
2780 * The escape process involves replacing the following symbols with their respective HTML character entities: `<`, `>`, `"`, `'`.
2781 *
2782 * Setting `escapeParameterHtml` as true should not break existing functionality but provides a safeguard against a subtle type of XSS attack vectors.
2783 *
2784 * @VueI18nSee [HTML Message](../guide/essentials/syntax#html-message)
2785 *
2786 * @defaultValue `false`
2787 */
2788 escapeParameterHtml?: Options['escapeParameter'];
2789 /**
2790 * @remarks
2791 * The shared locale messages of localization for components. More detail see Component based localization.
2792 *
2793 * @VueI18nSee [Shared locale messages for components](../guide/essentials/local#shared-locale-messages-for-components)
2794 *
2795 * @defaultValue `undefined`
2796 */
2797 sharedMessages?: LocaleMessages<VueMessageType>;
2798 /**
2799 * @remarks
2800 * A set of rules for word pluralization
2801 *
2802 * @VueI18nSee [Custom Pluralization](../guide/essentials/pluralization#custom-pluralization)
2803 *
2804 * @defaultValue `{}`
2805 */
2806 pluralizationRules?: Options['pluralRules'];
2807 /**
2808 * @remarks
2809 * A handler for post processing of translation. The handler gets after being called with the `$t`, `t`, `$tc`, and `tc`.
2810 *
2811 * This handler is useful if you want to filter on translated text such as space trimming.
2812 *
2813 * @defaultValue `null`
2814 */
2815 postTranslation?: Options['postTranslation'];
2816 /**
2817 * @remarks
2818 * Whether synchronize the root level locale to the component localization locale.
2819 *
2820 * If `false`, regardless of the root level locale, localize for each component locale.
2821 *
2822 * @VueI18nSee [Local Scope](../guide/essentials/scope#local-scope-2)
2823 *
2824 * @defaultValue `true`
2825 */
2826 sync?: boolean;
2827 /**
2828 * @remarks
2829 * A message resolver to resolve [`messages`](legacy#messages).
2830 *
2831 * If not specified, the vue-i18n internal message resolver will be used by default.
2832 *
2833 * You need to implement a message resolver yourself that supports the following requirements:
2834 *
2835 * - Resolve the message using the locale message of [`locale`](legacy#locale) passed as the first argument of the message resolver, and the path passed as the second argument.
2836 *
2837 * - If the message could not be resolved, you need to return `null`.
2838 *
2839 * - If you will be returned `null`, the message resolver will also be called on fallback if [`fallbackLocale`](legacy#fallbacklocale-2) is enabled, so the message will need to be resolved as well.
2840 *
2841 * The message resolver is called indirectly by the following APIs:
2842 *
2843 * - [`t`](legacy#t-key)
2844 *
2845 * - [`tc`](legacy#tc-key)
2846 *
2847 * - [`te`](legacy#te-key-locale)
2848 *
2849 * - [`tm`](legacy#tm-key)
2850 *
2851 * - [Translation component](component#translation)
2852 *
2853 * @example
2854 * Here is an example of how to set it up using your `createI18n`:
2855 * ```js
2856 * import { createI18n } from 'vue-i18n'
2857 *
2858 * // your message resolver
2859 * function messageResolver(obj, path) {
2860 * // simple message resolving!
2861 * const msg = obj[path]
2862 * return msg != null ? msg : null
2863 * }
2864 *
2865 * // call with I18n option
2866 * const i18n = createI18n({
2867 * locale: 'ja',
2868 * messageResolver, // set your message resolver
2869 * messages: {
2870 * en: { ... },
2871 * ja: { ... }
2872 * }
2873 * })
2874 *
2875 * // the below your something to do ...
2876 * // ...
2877 * ```
2878 *
2879 * @VueI18nTip
2880 * :new: v9.2+
2881 *
2882 * @VueI18nWarning
2883 * If you use the message resolver, the [`flatJson`](legacy#flatjson) setting will be ignored. That is, you need to resolve the flat JSON by yourself.
2884 *
2885 * @VueI18nSee [Fallbacking](../guide/essentials/fallback)
2886 *
2887 * @defaultValue `undefined`
2888 */
2889 messageResolver?: MessageResolver;
2890}
2891
2892/**
2893 * Resolve locale message translation functions for VueI18n legacy interfaces
2894 *
2895 * @remarks
2896 * This is the interface for {@link VueI18n}. This interface is an alias of {@link ComposerResolveLocaleMessageTranslation}.
2897 *
2898 * @VueI18nLegacy
2899 */
2900export declare type VueI18nResolveLocaleMessageTranslation<Locales = 'en-US'> = ComposerResolveLocaleMessageTranslation<Locales>;
2901
2902/**
2903 * Locale message translation functions for VueI18n legacy interfaces
2904 *
2905 * @remarks
2906 * This is the interface for {@link VueI18n}
2907 *
2908 * @VueI18nLegacy
2909 */
2910export declare interface VueI18nTranslation<Messages extends Record<string, any> = {}, Locales = 'en-US', DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>, C = IsEmptyObject<DefinedLocaleMessage> extends false ? PickupPaths<{
2911 [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K];
2912}> : never, M = IsEmptyObject<Messages> extends false ? PickupKeys<Messages> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
2913 /**
2914 * Locale message translation.
2915 *
2916 * @remarks
2917 * If this is used in a reactive context, it will re-evaluate once the locale changes.
2918 *
2919 * If [i18n component options](injection#i18n) is specified, it’s translated in preferentially local scope locale messages than global scope locale messages.
2920 *
2921 * If [i18n component options](injection#i18n) isn't specified, it’s translated with global scope locale messages.
2922 *
2923 * @param key - A target locale message key
2924 *
2925 * @returns Translated message
2926 *
2927 * @VueI18nSee [Scope and Locale Changing](../guide/essentials/scope)
2928 */
2929 <Key extends string>(key: Key | ResourceKeys): TranslateResult;
2930 /**
2931 * Locale message translation.
2932 *
2933 * @remarks
2934 * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) details.
2935 *
2936 * @param key - A target locale message key
2937 * @param locale - A locale, it will be used over than global scope or local scope.
2938 *
2939 * @returns Translated message
2940 */
2941 <Key extends string>(key: Key | ResourceKeys, locale: Locales | Locale): TranslateResult;
2942 /**
2943 * Locale message translation.
2944 *
2945 * @remarks
2946 * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) details.
2947 *
2948 * @param key - A target locale message key
2949 * @param locale - A locale, it will be used over than global scope or local scope.
2950 * @param list - A values of list interpolation
2951 *
2952 * @returns Translated message
2953 *
2954 * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
2955 */
2956 <Key extends string>(key: Key | ResourceKeys, locale: Locales | Locale, list: unknown[]): TranslateResult;
2957 /**
2958 * Locale message translation.
2959 *
2960 * @remarks
2961 * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) details.
2962 *
2963 * @param key - A target locale message key
2964 * @param locale - A locale, it will be used over than global scope or local scope.
2965 * @param named - A values of named interpolation
2966 *
2967 * @returns Translated message
2968 *
2969 * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
2970 */
2971 <Key extends string>(key: Key | ResourceKeys, locale: Locales | Locale, named: Record<string, unknown>): TranslateResult;
2972 /**
2973 * Locale message translation.
2974 *
2975 * @remarks
2976 * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) details.
2977 *
2978 * @param key - A target locale message key
2979 * @param list - A values of list interpolation
2980 *
2981 * @returns Translated message
2982 *
2983 * @VueI18nSee [List interpolation](../guide/essentials/syntax#list-interpolation)
2984 */
2985 <Key extends string>(key: Key | ResourceKeys, list: unknown[]): TranslateResult;
2986 /**
2987 * Locale message translation.
2988 *
2989 * @remarks
2990 * Overloaded `t`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult) details.
2991 *
2992 * @param key - A target locale message key
2993 * @param named - A values of named interpolation
2994 *
2995 * @returns Translated message
2996 *
2997 * @VueI18nSee [Named interpolation](../guide/essentials/syntax#named-interpolation)
2998 */
2999 <Key extends string>(key: Key | ResourceKeys, named: Record<string, unknown>): TranslateResult;
3000}
3001
3002/**
3003 * Locale message pluralization functions for VueI18n legacy interfaces
3004 *
3005 * @remarks
3006 * This is the interface for {@link VueI18n}
3007 *
3008 * @VueI18nLegacy
3009 */
3010export declare interface VueI18nTranslationChoice<Messages extends Record<string, any> = {}, Locales = 'en-US', DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>, C = IsEmptyObject<DefinedLocaleMessage> extends false ? PickupPaths<{
3011 [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K];
3012}> : never, M = IsEmptyObject<Messages> extends false ? PickupKeys<Messages> : never, ResourceKeys extends C | M = IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never> {
3013 /**
3014 * Locale message pluralization
3015 *
3016 * @remarks
3017 * If this is used in a reactive context, it will re-evaluate once the locale changes.
3018 *
3019 * If [i18n component options](injection#i18n) is specified, it’s pluraled in preferentially local scope locale messages than global scope locale messages.
3020 *
3021 * If [i18n component options](injection#i18n) isn't specified, it’s pluraled with global scope locale messages.
3022 *
3023 * The plural choice number is handled with default `1`.
3024 *
3025 * @param key - A target locale message key
3026 *
3027 * @returns Pluraled message
3028 *
3029 * @VueI18nSee [Pluralization](../guide/essentials/pluralization)
3030 */
3031 <Key extends string = string>(key: Key | ResourceKeys): TranslateResult;
3032 /**
3033 * Locale message pluralization
3034 *
3035 * @remarks
3036 * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
3037 *
3038 * @param key - A target locale message key
3039 * @param locale - A locale, it will be used over than global scope or local scope.
3040 *
3041 * @returns Pluraled message
3042 */
3043 <Key extends string = string>(key: Key | ResourceKeys, locale: Locales | Locale): TranslateResult;
3044 /**
3045 * Locale message pluralization
3046 *
3047 * @remarks
3048 * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
3049 *
3050 * @param key - A target locale message key
3051 * @param list - A values of list interpolation
3052 *
3053 * @returns Pluraled message
3054 */
3055 <Key extends string>(key: Key | ResourceKeys, list: unknown[]): TranslateResult;
3056 /**
3057 * Locale message pluralization
3058 *
3059 * @remarks
3060 * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
3061 *
3062 * @param key - A target locale message key
3063 * @param named - A values of named interpolation
3064 *
3065 * @returns Pluraled message
3066 */
3067 <Key extends string>(key: Key | ResourceKeys, named: Record<string, unknown>): TranslateResult;
3068 /**
3069 * Locale message pluralization
3070 *
3071 * @remarks
3072 * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
3073 *
3074 * @param key - A target locale message key
3075 * @param choice - Which plural string to get. 1 returns the first one.
3076 *
3077 * @returns Pluraled message
3078 */
3079 <Key extends string>(key: Key | ResourceKeys, choice: number): TranslateResult;
3080 /**
3081 * Locale message pluralization
3082 *
3083 * @remarks
3084 * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
3085 *
3086 * @param key - A target locale message key
3087 * @param choice - Which plural string to get. 1 returns the first one.
3088 * @param locale - A locale, it will be used over than global scope or local scope.
3089 *
3090 * @returns Pluraled message
3091 */
3092 <Key extends string>(key: Key | ResourceKeys, choice: number, locale: Locales | Locale): TranslateResult;
3093 /**
3094 * Locale message pluralization
3095 *
3096 * @remarks
3097 * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
3098 *
3099 * @param key - A target locale message key
3100 * @param choice - Which plural string to get. 1 returns the first one.
3101 * @param list - A values of list interpolation
3102 *
3103 * @returns Pluraled message
3104 */
3105 <Key extends string>(key: Key | ResourceKeys, choice: number, list: unknown[]): TranslateResult;
3106 /**
3107 * Locale message pluralization
3108 *
3109 * @remarks
3110 * Overloaded `tc`. About details, see the [call signature](legacy#key-key-resourcekeys-translateresult-2) details.
3111 *
3112 * @param key - A target locale message key
3113 * @param choice - Which plural string to get. 1 returns the first one.
3114 * @param named - A values of named interpolation
3115 *
3116 * @returns Pluraled message
3117 */
3118 <Key extends string>(key: Key | ResourceKeys, choice: number, named: Record<string, unknown>): TranslateResult;
3119}
3120
3121/** @VueI18nComposition */
3122export declare type VueMessageType = string | ResourceNode | VNode;
3123
3124export declare type WarnHtmlInMessageLevel = 'off' | 'warn' | 'error';
3125
3126export { }
3127
3128declare module '@vue/runtime-core' {
3129 /**
3130 * Component Custom Options for Vue I18n
3131 *
3132 * @VueI18nInjection
3133 */
3134 export interface ComponentCustomOptions {
3135 /**
3136 * VueI18n options
3137 *
3138 * @remarks
3139 * See the {@link VueI18nOptions}
3140 */
3141 i18n?: VueI18nOptions
3142 /**
3143 * For custom blocks options
3144 * @internal
3145 */
3146 __i18n?: CustomBlocks
3147 /**
3148 * For devtools
3149 * @internal
3150 */
3151 __INTLIFY_META__?: string
3152 }
3153
3154 /**
3155 * Component Custom Properties for Vue I18n
3156 *
3157 * @VueI18nInjection
3158 */
3159 export interface ComponentCustomProperties {
3160 /**
3161 * Exported Global Composer instance, or global VueI18n instance.
3162 *
3163 * @remarks
3164 * You can get the {@link ExportedGlobalComposer | exported composer instance} which are exported from global {@link Composer | composer instance} created with {@link createI18n}, or global {@link VueI18n | VueI18n instance}.
3165 * You can get the exported composer instance in {@link I18nMode | Composition API mode}, or the Vuei18n instance in {@link I18nMode | Legacy API mode}, which is the instance you can refer to with this property.
3166 * The locales, locale messages, and other resources managed by the instance referenced by this property are valid as global scope.
3167 * If the `i18n` component custom option is not specified, it's the same as the VueI18n instance that can be referenced by the i18n instance {@link I18n.global | global} property.
3168 */
3169 $i18n: VueI18n | ExportedGlobalComposer
3170 /**
3171 * Locale message translation
3172 *
3173 * @remarks
3174 * If this is used in a reactive context, it will re-evaluate once the locale changes.
3175 *
3176 * In {@link I18nMode | Legacy API mode}, the input / output is the same as for VueI18n instance. About that details, see {@link VueI18n#t | `VueI18n#t`}.
3177 *
3178 * In {@link I18nMode | Composition API mode}, the `$t` is injected by `app.config.globalProperties`.
3179 * the input / output is the same as for Composer, and it work on **global scope**. About that details, see {@link Composer#t | `Composer#t` }.
3180 *
3181 * @param key - A target locale message key
3182 *
3183 * @returns translation message
3184 */
3185 $t<
3186 Key extends string,
3187 DefinedLocaleMessage extends
3188 RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
3189 Keys = IsEmptyObject<DefinedLocaleMessage> extends false
3190 ? PickupPaths<{
3191 [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
3192 }>
3193 : never,
3194 ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
3195 >(
3196 key: Key | ResourceKeys | Path
3197 ): TranslateResult
3198 /**
3199 * Locale message translation
3200 *
3201 * @remarks
3202 * Overloaded `$t`. About details, see the {@link $t} remarks.
3203 *
3204 * @param key - A target locale message key
3205 * @param locale - A locale, override locale that global scope or local scope
3206 *
3207 * @returns translation message
3208 */
3209 $t<
3210 Key extends string,
3211 DefinedLocaleMessage extends
3212 RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
3213 Keys = IsEmptyObject<DefinedLocaleMessage> extends false
3214 ? PickupPaths<{
3215 [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
3216 }>
3217 : never,
3218 ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
3219 >(
3220 key: Key | ResourceKeys | Path
3221 ): TranslateResult
3222 /**
3223 * Locale message translation
3224 *
3225 * @remarks
3226 * Overloaded `$t`. About details, see the {@link $t} remarks.
3227 *
3228 * @param key - A target locale message key
3229 * @param locale - A locale, override locale that global scope or local scope
3230 * @param list - A values of list interpolation
3231 *
3232 * @returns translation message
3233 */
3234 $t<
3235 Key extends string,
3236 DefinedLocaleMessage extends
3237 RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
3238 Keys = IsEmptyObject<DefinedLocaleMessage> extends false
3239 ? PickupPaths<{
3240 [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
3241 }>
3242 : never,
3243 ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
3244 >(
3245 key: Key | ResourceKeys | Path,
3246 locale: Locale,
3247 list: unknown[]
3248 ): TranslateResult
3249 /**
3250 * Locale message translation
3251 *
3252 * @remarks
3253 * Overloaded `$t`. About details, see the {@link $t} remarks.
3254 *
3255 * @param key - A target locale message key
3256 * @param locale - A locale, override locale that global scope or local scope
3257 * @param named - A values of named interpolation
3258 *
3259 * @returns translation message
3260 */
3261 $t<
3262 Key extends string,
3263 DefinedLocaleMessage extends
3264 RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
3265 Keys = IsEmptyObject<DefinedLocaleMessage> extends false
3266 ? PickupPaths<{
3267 [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
3268 }>
3269 : never,
3270 ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
3271 >(
3272 key: Key | ResourceKeys | Path,
3273 locale: Locale,
3274 named: object
3275 ): TranslateResult
3276 /**
3277 * Locale message translation
3278 *
3279 * @remarks
3280 * Overloaded `$t`. About details, see the {@link $t} remarks.
3281 *
3282 * @param key - A target locale message key
3283 * @param list - A values of list interpolation
3284 *
3285 * @returns translation message
3286 */
3287 $t<
3288 Key extends string,
3289 DefinedLocaleMessage extends
3290 RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
3291 Keys = IsEmptyObject<DefinedLocaleMessage> extends false
3292 ? PickupPaths<{
3293 [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
3294 }>
3295 : never,
3296 ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
3297 >(
3298 key: Key | ResourceKeys | Path,
3299 list: unknown[]
3300 ): TranslateResult
3301 /**
3302 * Locale message translation
3303 *
3304 * @remarks
3305 * Overloaded `$t`. About details, see the {@link $t} remarks.
3306 *
3307 * @param key - A target locale message key
3308 * @param named - A values of named interpolation
3309 *
3310 * @returns translation message
3311 */
3312 $t<
3313 Key extends string,
3314 DefinedLocaleMessage extends
3315 RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>,
3316 Keys = IsEmptyObject<DefinedLocaleMessage> extends false
3317 ? PickupPaths<{
3318 [K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K]
3319 }>
3320 : never,
3321 ResourceKeys extends Keys = IsNever<Keys> extends false ? Keys : never
3322 >(
3323 key: Key | ResourceKeys | Path,
3324 named: Record<string, unknown>
3325 ): TranslateResult
3326 /**
3327 * Locale message translation
3328