vue-i18n / vue / ComponentCustomProperties
Interface: ComponentCustomProperties
Vue I18n Injection
Component Custom Properties for Vue I18n
Methods
$d()
Call Signature
$d(value): string;Datetime formatting
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | number | Date | A value, timestamp number or Date instance |
Returns
string
formatted value
Remarks
If this is used in a reactive context, it will re-evaluate once the locale changes.
In I18nMode | Composition API mode, the $d is injected by app.config.globalProperties. the input / output is the same as for Composer instance, and it work on global scope. About that details, see Composer#d | `Composer#d`.
Call Signature
$d<Value, Key, DefinedDateTimeFormat, Keys, ResourceKeys>(value, key): string;Datetime formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Value extends string | number | Date | number |
Key extends string | string |
DefinedDateTimeFormat extends RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> | RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> |
Keys | IsEmptyObject<DefinedDateTimeFormat> extends false ? PickupFormatPathKeys<{ [K in string | number | symbol]: DefinedDateTimeFormat[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | Value | A value, timestamp number or Date instance |
key | Key | ResourceKeys | A key of datetime formats |
Returns
string
formatted value
Remarks
Overloaded $d. About details, see the $d remarks.
Call Signature
$d<Value, Key, DefinedDateTimeFormat, Keys, ResourceKeys>(value, options): string;Datetime formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Value extends string | number | Date | number |
Key extends string | string |
DefinedDateTimeFormat extends RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> | RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> |
Keys | IsEmptyObject<DefinedDateTimeFormat> extends false ? PickupFormatPathKeys<{ [K in string | number | symbol]: DefinedDateTimeFormat[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | Value | A value, timestamp number or Date instance |
options | DateTimeOptions<Key | ResourceKeys> | An options |
Returns
string
formatted value
Remarks
Overloaded $d. About details, see the $d remarks.
Call Signature
$d<Value, Key, DefinedDateTimeFormat, Keys, ResourceKeys>(
value,
key,
locale): string;Datetime formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Value extends string | number | Date | number |
Key extends string | string |
DefinedDateTimeFormat extends RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> | RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> |
Keys | IsEmptyObject<DefinedDateTimeFormat> extends false ? PickupFormatPathKeys<{ [K in string | number | symbol]: DefinedDateTimeFormat[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | Value | A value, timestamp number or Date instance |
key | Key | ResourceKeys | A key of datetime formats |
locale | string | A locale, optional, override locale that global scope or local scope |
Returns
string
formatted value
Remarks
Overloaded $d. About details, see the $d remarks.
Call Signature
$d<Value, Key, DefinedDateTimeFormat, Keys, ResourceKeys, OptionsType>(
value,
options,
locale): IsPart<OptionsType> extends true ? DateTimeFormatPart[] : string;Datetime formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Value extends number | Date | number |
Key extends string | string |
DefinedDateTimeFormat extends RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> | RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> |
Keys | IsEmptyObject<DefinedDateTimeFormat> extends false ? PickupFormatPathKeys<{ [K in string | number | symbol]: DefinedDateTimeFormat[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
OptionsType | DateTimeOptions<Key | ResourceKeys, string> |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | Value | A value, timestamp number or Date instance |
options | OptionsType | An options |
locale | string | A locale, optional, override locale that global scope or local scope |
Returns
IsPart<OptionsType> extends true ? DateTimeFormatPart[] : string
formatted value
Remarks
Overloaded $d. About details, see the $d remarks.
$n()
Call Signature
$n(value): string;Number formatting
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | A number value |
Returns
string
formatted value
Remarks
If this is used in a reactive context, it will re-evaluate once the locale changes.
In I18nMode | Composition API mode, the $n is injected by app.config.globalProperties. the input / output is the same as for Composer instance, and it work on global scope. About that details, see Composer#n | `Composer.n`.
Call Signature
$n<Key, DefinedNumberFormat, Keys, ResourceKeys>(value, key): string;Number formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | string |
DefinedNumberFormat extends RemoveIndexSignature<{ [key: string]: NumberFormatOptions; }> | RemoveIndexSignature<{ [key: string]: NumberFormatOptions; }> |
Keys | IsEmptyObject<DefinedNumberFormat> extends false ? PickupFormatPathKeys<{ [K in string | number | symbol]: DefinedNumberFormat[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | A number value |
key | Key | ResourceKeys | A key of number formats |
Returns
string
formatted value
Remarks
Overloaded $n. About details, see the $n remarks.
Call Signature
$n<Key, DefinedNumberFormat, Keys, ResourceKeys, OptionsType>(value, options): IsPart<OptionsType> extends true ? NumberFormatPart[] : string;Number formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | string |
DefinedNumberFormat extends RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> | RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> |
Keys | IsEmptyObject<DefinedNumberFormat> extends false ? PickupFormatPathKeys<{ [K in string | number | symbol]: DefinedNumberFormat[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
OptionsType | NumberOptions<Key | ResourceKeys, string> |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | A number value |
options | OptionsType | An options, see the NumberOptions |
Returns
IsPart<OptionsType> extends true ? NumberFormatPart[] : string
formatted value
Remarks
Overloaded $n. About details, see the $n remarks.
Call Signature
$n<Key, DefinedNumberFormat, Keys, ResourceKeys>(
value,
key,
locale): string;Number formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | string |
DefinedNumberFormat extends RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> | RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> |
Keys | IsEmptyObject<DefinedNumberFormat> extends false ? PickupFormatPathKeys<{ [K in string | number | symbol]: DefinedNumberFormat[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | A number value |
key | Key | ResourceKeys | A key of number formats |
locale | string | A locale, optional, override locale that global scope or local scope |
Returns
string
formatted value
Remarks
Overloaded $n. About details, see the $n remarks.
Call Signature
$n<Key, DefinedNumberFormat, Keys, ResourceKeys, OptionsType>(
value,
options,
locale): IsPart<OptionsType> extends true ? NumberFormatPart[] : string;Number formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | string |
DefinedNumberFormat extends RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> | RemoveIndexSignature<{ [key: string]: DateTimeFormatOptions; }> |
Keys | IsEmptyObject<DefinedNumberFormat> extends false ? PickupFormatPathKeys<{ [K in string | number | symbol]: DefinedNumberFormat[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
OptionsType | NumberOptions<Key | ResourceKeys, string> |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | A number value |
options | OptionsType | An options, see the NumberOptions |
locale | string | A locale, optional, override locale that global scope or local scope |
Returns
IsPart<OptionsType> extends true ? NumberFormatPart[] : string
formatted value
Remarks
Overloaded $n. About details, see the $n remarks.
$rt()
Call Signature
$rt(message): string;Resolve locale message translation
Parameters
| Parameter | Type | Description |
|---|---|---|
message | | VueMessageType | MessageFunction<VueMessageType> | A target locale message to be resolved. You will need to specify the locale message returned by $tm. |
Returns
string
translated message
Remarks
If this is used in a reactive context, it will re-evaluate once the locale changes.
In I18nMode | Composition API mode, the $rt is injected by app.config.globalProperties. the input / output is the same as for Composer, and it work on global scope. About that details, see Composer#rt | `Composer#rt`.
Call Signature
$rt(
message,
plural,
options?): string;Resolve locale message translation for plurals
Parameters
| Parameter | Type | Description |
|---|---|---|
message | | VueMessageType | MessageFunction<VueMessageType> | A target locale message to be resolved. You will need to specify the locale message returned by $tm. |
plural | number | Which plural string to get. 1 returns the first one. |
options? | TranslateOptions<string> | Additional options for translation |
Returns
string
Translated message
Remarks
Overloaded $rt. About details, see the $rt remarks.
Call Signature
$rt(
message,
list,
options?): string;Resolve locale message translation for list interpolations
Parameters
| Parameter | Type | Description |
|---|---|---|
message | | VueMessageType | MessageFunction<VueMessageType> | A target locale message to be resolved. You will need to specify the locale message returned by $tm. |
list | unknown[] | A values of list interpolation. |
options? | TranslateOptions<string> | Additional options for translation |
Returns
string
Translated message
Remarks
Overloaded $rt. About details, see the $rt remarks.
Call Signature
$rt(
message,
named,
options?): string;Resolve locale message translation for named interpolations
Parameters
| Parameter | Type | Description |
|---|---|---|
message | | VueMessageType | MessageFunction<VueMessageType> | A target locale message to be resolved. You will need to specify the locale message returned by $tm. |
named | NamedValue | A values of named interpolation. |
options? | TranslateOptions<string> | Additional options for translation |
Returns
string
Translated message
Remarks
Overloaded $rt. About details, see the $rt remarks.
$t()
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(key): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | Key | ResourceKeys | A target locale message key |
Returns
string
translation message
Remarks
If this is used in a reactive context, it will re-evaluate once the locale changes.
In I18nMode | Composition API mode, the $t is injected by app.config.globalProperties. the input / output is the same as for Composer, and it work on global scope. About that details, see Composer#t | `Composer#t`.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(key, plural): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | Key | ResourceKeys | A target locale message key |
plural | number | A choice number of plural |
Returns
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(
key,
plural,
options): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | Key | ResourceKeys | A target locale message key |
plural | number | Which plural string to get. 1 returns the first one. |
options | TranslateOptions | An options, see the TranslateOptions |
Returns
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(key, defaultMsg): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | Key | ResourceKeys | A target locale message key |
defaultMsg | string | A default message to return if no translation was found |
Returns
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(
key,
defaultMsg,
options): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | Key | ResourceKeys | A target locale message key |
defaultMsg | string | A default message to return if no translation was found |
options | TranslateOptions | An options, see the TranslateOptions |
Returns
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(key, list): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | Key | ResourceKeys | A target locale message key |
list | unknown[] | A values of list interpolation |
Returns
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(
key,
list,
plural): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | Key | ResourceKeys | A target locale message key |
list | unknown[] | A values of list interpolation |
plural | number | A choice number of plural |
Returns
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(
key,
list,
defaultMsg): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | 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
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(
key,
list,
options): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | Key | ResourceKeys | A target locale message key |
list | unknown[] | A values of list interpolation |
options | TranslateOptions | An options, see the TranslateOptions |
Returns
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(key, named): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | Key | ResourceKeys | A target locale message key |
named | NamedValue | A values of named interpolation |
Returns
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(
key,
named,
plural): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | Key | ResourceKeys | A target locale message key |
named | NamedValue | A values of named interpolation |
plural | number | A choice number of plural |
Returns
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(
key,
named,
defaultMsg): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | 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
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
Call Signature
$t<Key, DefinedLocaleMessage, Keys, ResourceKeys>(
key,
named,
options): string;Locale message translation
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | number | Key | ResourceKeys | A target locale message key |
named | NamedValue | A values of named interpolation |
options | TranslateOptions | An options, see the TranslateOptions |
Returns
string
translation message
Remarks
Overloaded $t. About details, see the $t remarks.
$te()
$te<Key, DefinedLocaleMessage, Keys, ResourceKeys>(key, locale?): boolean;Translation message exist
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | Key | ResourceKeys | A target locale message key |
locale? | string | A locale, optional, override locale that global scope or local scope |
Returns
boolean
If found locale message, true, else false, Note that false is returned even if the value present in the key is not translatable.
Remarks
About that details, see VueI18n#te | `VueI18n#te` or Composer#te | `Composer#te`.
$tm()
$tm<Key, DefinedLocaleMessage, Keys, ResourceKeys>(key):
| {
}
| LocaleMessageValue<VueMessageType>;Locale messages getter
Type Parameters
| Type Parameter | Default type |
|---|---|
Key extends string | - |
DefinedLocaleMessage extends RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> | RemoveIndexSignature<{ [key: string]: LocaleMessageValue<VueMessageType>; }> |
Keys | IsEmptyObject<DefinedLocaleMessage> extends false ? JsonPaths<{ [K in string | number | symbol]: DefinedLocaleMessage[K] }> : never |
ResourceKeys | IsNever<Keys> extends false ? Keys : never |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | Key | ResourceKeys | A target locale message key |
Returns
| { } | LocaleMessageValue<VueMessageType>
locale messages
Remarks
In I18nMode | Composition API mode, the $tm is injected by app.config.globalProperties. the input / output is the same as for Composer instance, and it work on global scope. About that details, see Composer#tm | `Composer.tm`. 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.
Properties
$i18n
$i18n: ExportedGlobalComposer;Exported Global Composer instance
Remarks
You can get the exported composer instance which are exported from global Composer | composer instance created with createI18n You can get the exported composer instance in I18nMode | Composition API mode The locales, locale messages, and other resources managed by the instance referenced by this property are valid as global scope. 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 I18n.global | global property.