Legacy API
Choice
Signature:
export type Choice = number;
DEPRECATED
will be removed at vue-i18n v12
DateTimeFormatResult
Signature:
export type DateTimeFormatResult = string;
DEPRECATED
will be removed at vue-i18n v12
LocaleMessageObject
Signature:
export type LocaleMessageObject<Message = string> = LocaleMessageDictionary<Message>;
DEPRECATED
will be removed at vue-i18n v12
NumberFormatResult
Signature:
export type NumberFormatResult = string;
DEPRECATED
will be removed at vue-i18n v12
PluralizationRulesMap
Signature:
export type PluralizationRulesMap = {
[locale: string]: PluralizationRule;
};
DEPRECATED
will be removed at vue-i18n v12
TranslateResult
Signature:
export type TranslateResult = string;
DEPRECATED
will be removed at vue-i18n v12
VueI18n
VueI18n legacy interfaces
Signature:
export 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 = Locale extends GeneratedLocale ? GeneratedLocale : OptionLocale extends string ? [ResourceLocales] extends [never] ? Locale : ResourceLocales : OptionLocale | ResourceLocales, Composition extends Composer<Messages, DateTimeFormats, NumberFormats, OptionLocale> = Composer<Messages, DateTimeFormats, NumberFormats, OptionLocale>>
DEPRECATED
will be removed at vue-i18n v12
Details
This interface is compatible with interface of VueI18n
class (offered with Vue I18n v8.x).
availableLocales
Signature:
readonly availableLocales: Composition['availableLocales'];
Details
The list of available locales in messages
in lexical order.
d
Datetime formatting
Signature:
d: VueI18nDateTimeFormatting<DateTimeFormats, Locales, RemoveIndexSignature<{
[K in keyof DefineDateTimeFormat]: DefineDateTimeFormat[K];
}>>;
Details
About details functions, See the VueI18nDateTimeFormatting
datetimeFormats
Signature:
readonly datetimeFormats: {
[K in keyof DateTimeFormats]: DateTimeFormats[K];
};
Details
The datetime formats of localization.
See Also
escapeParameterHtml
Signature:
escapeParameterHtml: Composition['escapeParameter'];
Details
Whether interpolation parameters are escaped before the message is translated.
See Also
fallbackLocale
Signature:
fallbackLocale: FallbackLocales<Locales>;
Details
The current fallback locales this VueI18n instance is using.
See Also
formatFallbackMessages
Signature:
formatFallbackMessages: Composition['fallbackFormat'];
Details
Whether suppress warnings when falling back to either fallbackLocale
or root.
See Also
getDateTimeFormat
Get datetime format
Signature:
getDateTimeFormat: Composition['getDateTimeFormat'];
Details
get datetime format from VueI18n instance datetimeFormats.
getLocaleMessage
Get locale message
Signature:
getLocaleMessage: Composition['getLocaleMessage'];
Details
get locale message from VueI18n instance messages.
getNumberFormat
Get number format
Signature:
getNumberFormat: Composition['getNumberFormat'];
Details
get number format from VueI18n instance numberFormats.
id
Signature:
id: number;
Details
Instance ID.
locale
Signature:
locale: Locales;
Details
The current locale this VueI18n instance is using.
If the locale contains a territory and a dialect, this locale contains an implicit fallback.
See Also
mergeDateTimeFormat
Merge datetime format
Signature:
mergeDateTimeFormat: Composition['mergeDateTimeFormat'];
Details
Merge datetime format to VueI18n instance datetimeFormats.
mergeLocaleMessage
Merge locale message
Signature:
mergeLocaleMessage: Composition['mergeLocaleMessage'];
Details
Merge locale message to VueI18n instance messages.
mergeNumberFormat
Merge number format
Signature:
mergeNumberFormat: Composition['mergeNumberFormat'];
Details
Merge number format to VueI18n instance numberFormats.
messages
Signature:
readonly messages: {
[K in keyof Messages]: Messages[K];
};
Details
The locale messages of localization.
See Also
missing
Signature:
missing: MissingHandler | null;
Details
A handler for localization missing.
modifiers
Signature:
readonly modifiers: Composition['modifiers'];
Details
Custom Modifiers for linked messages.
See Also
n
Number Formatting
Signature:
n: VueI18nNumberFormatting<NumberFormats, Locales, RemoveIndexSignature<{
[K in keyof DefineNumberFormat]: DefineNumberFormat[K];
}>>;
Details
About details functions, See the VueI18nNumberFormatting
numberFormats
Signature:
readonly numberFormats: {
[K in keyof NumberFormats]: NumberFormats[K];
};
Details
The number formats of localization.
See Also
pluralizationRules
A set of rules for word pluralization
Signature:
pluralizationRules: Composition['pluralRules'];
See Also
postTranslation
Signature:
postTranslation: PostTranslationHandler<VueMessageType> | null;
Details
A handler for post processing of translation.
rt
Resolve locale message translation
Signature:
rt: VueI18nResolveLocaleMessageTranslation<Locales>;
Details
About details functions, See the VueI18nResolveLocaleMessageTranslation
setDateTimeFormat
Set datetime format
Signature:
setDateTimeFormat: Composition['setDateTimeFormat'];
Details
Set datetime format to VueI18n instance datetimeFormats.
setLocaleMessage
Set locale message
Signature:
setLocaleMessage: Composition['setLocaleMessage'];
Details
Set locale message to VueI18n instance messages.
setNumberFormat
Set number format
Signature:
setNumberFormat: Composition['setNumberFormat'];
Details
Set number format to VueI18n instance numberFormats.
silentFallbackWarn
Signature:
silentFallbackWarn: Composition['fallbackWarn'];
Details
Whether suppress fallback warnings when localization fails.
silentTranslationWarn
Signature:
silentTranslationWarn: Composition['missingWarn'];
Details
Whether suppress warnings outputted when localization fails.
See Also
sync
Signature:
sync: Composition['inheritLocale'];
Details
Whether synchronize the root level locale to the component localization locale.
See Also
t
Locale message translation
Signature:
t: VueI18nTranslation<Messages, Locales, RemoveIndexSignature<{
[K in keyof DefineLocaleMessage]: DefineLocaleMessage[K];
}>>;
Details
About details functions, See the VueI18nTranslation
tm
Locale messages getter
Signature:
tm: Composition['tm'];
Details
If i18n component options is specified, it’s get in preferentially local scope locale messages than global scope locale messages.
If i18n component options isn't specified, it’s get with global scope locale messages.
Based on the current locale
, locale messages will be returned from Composer instance messages.
If you change the locale
, the locale messages returned will also correspond to the locale.
If there are no locale messages for the given key
in the composer instance messages, they will be returned with fallbacking.
WARNING
You need to use rt
for the locale message returned by tm
. see the rt details.
Examples
template:
<div class="container">
<template v-for="content in $tm('contents')">
<h2>{{ $rt(content.title) }}</h2>
<p v-for="paragraph in content.paragraphs">
{{ $rt(paragraph) }}
</p>
</template>
</div>
import { createI18n } from 'vue-i18n'
const i18n = createI18n({
messages: {
en: {
contents: [
{
title: 'Title1',
// ...
paragraphs: [
// ...
]
}
]
}
}
// ...
})
warnHtmlInMessage
Signature:
warnHtmlInMessage: WarnHtmlInMessageLevel;
Details
Whether to allow the use locale messages of HTML formatting.
If you set warn
or error
, will check the locale messages on the VueI18n instance.
If you are specified warn
, a warning will be output at console.
If you are specified error
will occurred an Error.
See Also
te(key, locale)
Translation locale message exist
Signature:
te<Str extends string, Key extends PickupKeys<Messages> = PickupKeys<Messages>>(key: Str | Key, locale?: Locales): boolean;
Details
whether do exist locale message on VueI18n instance messages.
If you specified locale
, check the locale messages of locale
.
Parameters
Parameter | Type | Description |
---|---|---|
key | Str | Key | A target locale message key |
locale | Locales | A target locale |
Returns
If found locale message, true
, else false
VueI18nDateTimeFormatting
Datetime formatting functions for VueI18n legacy interfaces
Signature:
export interface VueI18nDateTimeFormatting<DateTimeFormats extends Record<string, any> = {}, Locales = 'en-US', DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> = RemovedIndexResources<DefineDateTimeFormat>, C = IsEmptyObject<DefinedDateTimeFormat> extends false ? PickupFormatPathKeys<{
[K in keyof DefinedDateTimeFormat]: DefinedDateTimeFormat[K];
}> : 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>
DEPRECATED
will be removed at vue-i18n v12
Details
This is the interface for VueI18n
(value: number | Date): DateTimeFormatResult;
Datetime formatting
Signature:
(value: number | Date): DateTimeFormatResult;
Details
If this is used in a reactive context, it will re-evaluate once the locale changes.
If i18n component options is specified, it’s formatted in preferentially local scope datetime formats than global scope locale messages.
If i18n component options isn't specified, it’s formatted with global scope datetime formats.
See Also
Parameters
Parameter | Type | Description |
---|---|---|
value | number | Date | A value, timestamp number or Date instance |
Returns
Formatted value
(value: Value, key: Key | ResourceKeys): DateTimeFormatResult;
Datetime formatting
Signature:
<Value extends number | Date = number, Key extends string = string>(value: Value, key: Key | ResourceKeys): DateTimeFormatResult;
Details
Overloaded d
. About details, see the call signature details.
Parameters
Parameter | Type | Description |
---|---|---|
value | Value | A value, timestamp number or Date instance |
key | Key | ResourceKeys | A key of datetime formats |
Returns
Formatted value
(value: Value, key: Key | ResourceKeys, locale: Locales): DateTimeFormatResult;
Datetime formatting
Signature:
<Value extends number | Date = number, Key extends string = string>(value: Value, key: Key | ResourceKeys, locale: Locales): DateTimeFormatResult;
Details
Overloaded d
. About details, see the call signature details.
Parameters
Parameter | Type | Description |
---|---|---|
value | Value | A value, timestamp number or Date instance |
key | Key | ResourceKeys | A key of datetime formats |
locale | Locales | A locale, it will be used over than global scope or local scope. |
Returns
Formatted value
(value: number | Date, args: { [key: string]: string | boolean | number; }): DateTimeFormatResult;
Datetime formatting
Signature:
(value: number | Date, args: {
[key: string]: string | boolean | number;
}): DateTimeFormatResult;
Details
Overloaded d
. About details, see the call signature details.
Parameters
Parameter | Type | Description |
---|---|---|
value | number | Date | A value, timestamp number or Date instance |
args | { [key: string]: string | boolean | number; } | An argument values |
Returns
Formatted value
VueI18nNumberFormatting
Number formatting functions for VueI18n legacy interfaces
Signature:
export interface VueI18nNumberFormatting<NumberFormats extends Record<string, any> = {}, Locales = 'en-US', DefinedNumberFormat extends RemovedIndexResources<DefineNumberFormat> = RemovedIndexResources<DefineNumberFormat>, C = IsEmptyObject<DefinedNumberFormat> extends false ? PickupFormatPathKeys<{
[K in keyof DefinedNumberFormat]: DefinedNumberFormat[K];
}> : 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>
DEPRECATED
will be removed at vue-i18n v12
Details
This is the interface for VueI18n
(value: number): NumberFormatResult;
Number formatting
Signature:
(value: number): NumberFormatResult;
Details
If this is used in a reactive context, it will re-evaluate once the locale changes.
If i18n component options is specified, it’s formatted in preferentially local scope number formats than global scope locale messages.
If i18n component options isn't specified, it’s formatted with global scope number formats.
See Also
Parameters
Parameter | Type | Description |
---|---|---|
value | number | A number value |
Returns
Formatted value
(value: number, key: Key | ResourceKeys): NumberFormatResult;
Number formatting
Signature:
<Key extends string = string>(value: number, key: Key | ResourceKeys): NumberFormatResult;
Details
Overloaded n
. About details, see the call signature details.
Parameters
Parameter | Type | Description |
---|---|---|
value | number | A number value |
key | Key | ResourceKeys | A key of number formats |
Returns
Formatted value
(value: number, key: Key | ResourceKeys, locale: Locales): NumberFormatResult;
Number formatting
Signature:
<Key extends string = string>(value: number, key: Key | ResourceKeys, locale: Locales): NumberFormatResult;
Details
Overloaded n
. About details, see the call signature details.
Parameters
Parameter | Type | Description |
---|---|---|
value | number | A number value |
key | Key | ResourceKeys | A key of number formats |
locale | Locales | A locale, it will be used over than global scope or local scope. |
Returns
Formatted value
(value: number, args: { [key: string]: string | boolean | number; }): NumberFormatResult;
Number formatting
Signature:
(value: number, args: {
[key: string]: string | boolean | number;
}): NumberFormatResult;
Details
Overloaded n
. About details, see the call signature details.
Parameters
Parameter | Type | Description |
---|---|---|
value | number | A number value |
args | { [key: string]: string | boolean | number; } | An argument values |
Returns
Formatted value
VueI18nOptions
VueI18n Options
Signature:
export interface VueI18nOptions<Schema extends {
message?: unknown;
datetime?: unknown;
number?: unknown;
} = {
message: DefaultLocaleMessageSchema;
datetime: DefaultDateTimeFormatSchema;
number: DefaultNumberFormatSchema;
}, Locales extends {
messages: unknown;
datetimeFormats: unknown;
numberFormats: unknown;
} | string = Locale, Options extends ComposerOptions<Schema, Locales> = ComposerOptions<Schema, Locales>>
DEPRECATED
will be removed at vue-i18n v12
Details
This option is compatible with VueI18n
class constructor options (offered with Vue I18n v8.x)
availableLocales
Signature:
availableLocales?: Locale[];
Details
The list of available locales in messages in lexical order.
Default Value
[]
datetime
datetimeFormats
escapeParameterHtml
Signature:
escapeParameterHtml?: Options['escapeParameter'];
Details
If escapeParameterHtml
is configured as true then interpolation parameters are escaped before the message is translated.
This is useful when translation output is used in v-html
and the translation resource contains html markup (e.g. around a user provided value).
This usage pattern mostly occurs when passing precomputed text strings into UI components.
The escape process involves replacing the following symbols with their respective HTML character entities: <
, >
, "
, '
.
Setting escapeParameterHtml
as true should not break existing functionality but provides a safeguard against a subtle type of XSS attack vectors.
Default Value
false
See Also
fallbackLocale
Signature:
fallbackLocale?: Options['fallbackLocale'];
Details
The locale of fallback localization.
For more complex fallback definitions see fallback.
Default Value
The default 'en-US'
for the locale
if it's not specified, or it's locale
value
See Also
fallbackRoot
Signature:
fallbackRoot?: Options['fallbackRoot'];
Details
In the component localization, whether to fall back to root level (global scope) localization when localization fails.
If false
, it's not fallback to root.
Default Value
true
See Also
flatJson
Signature:
flatJson?: Options['flatJson'];
Details
Allow use flat json messages or not
Default Value
false
formatFallbackMessages
Signature:
formatFallbackMessages?: Options['fallbackFormat'];
Details
Whether suppress warnings when falling back to either fallbackLocale
or root.
Default Value
false
See Also
locale
Signature:
locale?: Options['locale'];
Details
The locale of localization.
If the locale contains a territory and a dialect, this locale contains an implicit fallback.
Default Value
'en-US'
See Also
message
messageResolver
Signature:
messageResolver?: MessageResolver;
Details
A message resolver to resolve messages
.
If not specified, the vue-i18n internal message resolver will be used by default.
You need to implement a message resolver yourself that supports the following requirements:
Resolve the message using the locale message of
locale
passed as the first argument of the message resolver, and the path passed as the second argument.If the message could not be resolved, you need to return
null
.If you will be returned
null
, the message resolver will also be called on fallback iffallbackLocale
is enabled, so the message will need to be resolved as well.
The message resolver is called indirectly by the following APIs:
TIP
🆕 v9.2+
WARNING
If you use the message resolver, the flatJson
setting will be ignored. That is, you need to resolve the flat JSON by yourself.
Default Value
undefined
See Also
Examples
Here is an example of how to set it up using your createI18n
:
import { createI18n } from 'vue-i18n'
// your message resolver
function messageResolver(obj, path) {
// simple message resolving!
const msg = obj[path]
return msg != null ? msg : null
}
// call with I18n option
const i18n = createI18n({
locale: 'ja',
messageResolver, // set your message resolver
messages: {
en: { ... },
ja: { ... }
}
})
// the below your something to do ...
// ...
messages
missing
Signature:
missing?: Options['missing'];
Details
A handler for localization missing.
The handler gets called with the localization target locale, localization path key, the Vue instance and values.
If missing handler is assigned, and occurred localization missing, it's not warned.
Default Value
null
modifiers
Signature:
modifiers?: Options['modifiers'];
Details
Custom Modifiers for linked messages.
See Also
number
numberFormats
pluralizationRules
Signature:
pluralizationRules?: Options['pluralRules'];
Details
A set of rules for word pluralization
Default Value
{}
See Also
postTranslation
Signature:
postTranslation?: Options['postTranslation'];
Details
A handler for post processing of translation. The handler gets after being called with the $t
, and t
.
This handler is useful if you want to filter on translated text such as space trimming.
Default Value
null
sharedMessages
Signature:
sharedMessages?: LocaleMessages<VueMessageType>;
Details
The shared locale messages of localization for components. More detail see Component based localization.
Default Value
undefined
See Also
silentFallbackWarn
Signature:
silentFallbackWarn?: Options['fallbackWarn'];
Details
Whether do template interpolation on translation keys when your language lacks a translation for a key.
If true
, skip writing templates for your "base" language; the keys are your templates.
Default Value
false
See Also
silentTranslationWarn
Signature:
silentTranslationWarn?: Options['missingWarn'];
Details
Whether suppress warnings outputted when localization fails.
If true
, suppress localization fail warnings.
If you use regular expression, you can suppress localization fail warnings that it match with translation key (e.g. t
).
Default Value
false
See Also
sync
Signature:
sync?: boolean;
Details
Whether synchronize the root level locale to the component localization locale.
If false
, regardless of the root level locale, localize for each component locale.
Default Value
true
See Also
warnHtmlInMessage
Signature:
warnHtmlInMessage?: WarnHtmlInMessageLevel;
Details
Whether to allow the use locale messages of HTML formatting.
See the warnHtmlInMessage property.
Default Value
'off'
See Also
VueI18nResolveLocaleMessageTranslation
Resolve locale message translation functions for VueI18n legacy interfaces
Signature:
export type VueI18nResolveLocaleMessageTranslation<Locales = 'en-US'> = ComposerResolveLocaleMessageTranslation<Locales>;
DEPRECATED
will be removed at vue-i18n v12
Details
This is the interface for VueI18n. This interface is an alias of ComposerResolveLocaleMessageTranslation.
VueI18nTranslation
Locale message translation functions for VueI18n legacy interfaces
Signature:
export interface VueI18nTranslation<Messages extends Record<string, any> = {}, Locales = 'en-US', DefinedLocaleMessage extends RemovedIndexResources<DefineLocaleMessage> = RemovedIndexResources<DefineLocaleMessage>, C = IsEmptyObject<DefinedLocaleMessage> extends false ? PickupPaths<{
[K in keyof DefinedLocaleMessage]: DefinedLocaleMessage[K];
}> : 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>
DEPRECATED
will be removed at vue-i18n v12
Details
This is the interface for VueI18n
(key: Key | ResourceKeys): TranslateResult;
Locale message translation.
Signature:
<Key extends string>(key: Key | ResourceKeys): TranslateResult;
Details
If this is used in a reactive context, it will re-evaluate once the locale changes.
If i18n component options is specified, it’s translated in preferentially local scope locale messages than global scope locale messages.
If i18n component options isn't specified, it’s translated with global scope locale messages.
See Also
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
Returns
Translated message
(key: Key | ResourceKeys, named: Record<string, unknown>): TranslateResult;
Locale message translation.
Signature:
<Key extends string>(key: Key | ResourceKeys, named: Record<string, unknown>): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
See Also
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
named | Record<string, unknown> | A values of named interpolation |
Returns
Translated message
(key: Key | ResourceKeys, named: NamedValue, plural: number): TranslateResult;
Locale message translation for named interpolations and plurals
Signature:
<Key extends string>(key: Key | ResourceKeys, named: NamedValue, plural: number): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
In this overloaded t
, for each placeholder x, the locale messages should contain a {x}
token, and return a pluralized translation message.
See Also
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
named | NamedValue | A values of named interpolation |
plural | number | Which plural string to get. 1 returns the first one. |
Returns
Translated message
(key: Key | ResourceKeys, named: NamedValue, defaultMsg: string): TranslateResult;
Locale message translation for named interpolations and plurals
Signature:
<Key extends string>(key: Key | ResourceKeys, named: NamedValue, defaultMsg: string): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
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.
See Also
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
named | NamedValue | A values of named interpolation |
defaultMsg | string | A default message to return if no translation was found |
Returns
Translated message
(key: Key | ResourceKeys, named: NamedValue, options: TranslateOptions<Locales>): TranslateResult;
Locale message translation for named interpolations
Signature:
<Key extends string>(key: Key | ResourceKeys, named: NamedValue, options: TranslateOptions<Locales>): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
In this overloaded t
, for each placeholder x, the locale messages should contain a {x}
token.
You can also suppress the warning, when the translation missing according to the options.
About details of options, see the .
See Also
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
named | NamedValue | A values of named interpolation |
options | TranslateOptions<Locales> | Additional for translation |
Returns
Translated message
(key: Key | ResourceKeys, plural: number): TranslateResult;
Locale message translation for plurals
Signature:
<Key extends string>(key: Key | ResourceKeys, plural: number): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
In this overloaded t
, return a pluralized translation message.
You can also suppress the warning, when the translation missing according to the options.
See Also
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
plural | number | Which plural string to get. 1 returns the first one. |
Returns
Translated message
(key: Key | ResourceKeys, plural: number, options: TranslateOptions<Locales>): TranslateResult;
Locale message translation for plurals
Signature:
<Key extends string>(key: Key | ResourceKeys, plural: number, options: TranslateOptions<Locales>): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
In this overloaded t
, return a pluralized translation message.
You can also suppress the warning, when the translation missing according to the options.
About details of options, see the .
See Also
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
plural | number | Which plural string to get. 1 returns the first one. |
options | TranslateOptions<Locales> | Additional for translation |
Returns
Translated message
(key: Key | ResourceKeys, defaultMsg: string): TranslateResult;
Locale message translation for missing default message
Signature:
<Key extends string>(key: Key | ResourceKeys, defaultMsg: string): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
In this overloaded t
, if no translation was found, return a default message.
You can also suppress the warning, when the translation missing according to the options.
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
defaultMsg | string | A default message to return if no translation was found |
Returns
Translated message
(key: Key | ResourceKeys, defaultMsg: string, options: TranslateOptions<Locales>): TranslateResult;
Locale message translation for missing default message
Signature:
<Key extends string>(key: Key | ResourceKeys, defaultMsg: string, options: TranslateOptions<Locales>): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
In this overloaded t
, if no translation was found, return a default message.
You can also suppress the warning, when the translation missing according to the options.
About details of options, see the .
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
defaultMsg | string | A default message to return if no translation was found |
options | TranslateOptions<Locales> | Additional for translation |
Returns
Translated message
(key: Key | ResourceKeys, list: unknown[]): TranslateResult;
Locale message translation.
Signature:
<Key extends string>(key: Key | ResourceKeys, list: unknown[]): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
See Also
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
list | unknown[] | A values of list interpolation |
Returns
Translated message
(key: Key | ResourceKeys, list: unknown[], plural: number): TranslateResult;
Locale message translation for list interpolations and plurals
Signature:
<Key extends string>(key: Key | ResourceKeys, list: unknown[], plural: number): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
In this overloaded t
, the locale messages should contain a {0}
, {1}
, … for each placeholder in the list, and return a pluralized translation message.
See Also
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
list | unknown[] | A values of list interpolation |
plural | number | Which plural string to get. 1 returns the first one. |
Returns
Translated message
(key: Key | ResourceKeys, list: unknown[], defaultMsg: string): TranslateResult;
Locale message translation for list interpolations and missing default message
Signature:
<Key extends string>(key: Key | ResourceKeys, list: unknown[], defaultMsg: string): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
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.
See Also
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
list | unknown[] | A values of list interpolation |
defaultMsg | string | A default message to return if no translation was found |
Returns
Translated message
(key: Key | ResourceKeys, list: unknown[], options: TranslateOptions<Locales>): TranslateResult;
Locale message translation for list interpolations
Signature:
<Key extends string>(key: Key | ResourceKeys, list: unknown[], options: TranslateOptions<Locales>): TranslateResult;
Details
Overloaded t
. About details, see the call signature details.
In this overloaded t
, the locale messages should contain a {0}
, {1}
, … for each placeholder in the list.
You can also suppress the warning, when the translation missing according to the options.
About details of options, see the .
See Also
Parameters
Parameter | Type | Description |
---|---|---|
key | Key | ResourceKeys | A target locale message key |
list | unknown[] | A values of list interpolation |
options | TranslateOptions<Locales> | Additional for translation |
Returns
Translated message
WarnHtmlInMessageLevel
Signature:
export type WarnHtmlInMessageLevel = 'off' | 'warn' | 'error';
DEPRECATED
will be removed at vue-i18n v12