Skip to content

vue-i18n / general / ComposerResolveLocaleMessageTranslation

Interface: ComposerResolveLocaleMessageTranslation()<Locales> ​

Resolve locale message translation functions

Remarks ​

This is the interface for Composer

Vue I18n Composition ​

Type Parameters ​

Type ParameterDefault type
Locales"en-US"

Call Signature ​

ts
ComposerResolveLocaleMessageTranslation(message): string;

Resolve locale message translation

Parameters ​

ParameterTypeDescription
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.

If UseI18nScope 'local' or Some UseI18nOptions are specified at useI18n, it’s translated in preferentially local scope locale messages than global scope locale messages.

If not, then it’s translated with global scope locale messages.

TIP

The use-case for rt is for programmatic locale messages translation with using tm, v-for, javascript for statement.

WARNING

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.

See about:

Call Signature ​

ts
ComposerResolveLocaleMessageTranslation(
   message, 
   plural, 
   options?): string;

Resolve locale message translation for plurals

Parameters ​

ParameterTypeDescription
message| VueMessageType | MessageFunction<VueMessageType>A target locale message to be resolved. You will need to specify the locale message returned by tm.
pluralnumberWhich plural string to get. 1 returns the first one.
options?TranslateOptions<Locales>Additional options for translation

Returns ​

string

Translated message

Remarks ​

Overloaded rt.

In this overloaded rt, return a pluralized translation message.

TIP

The use-case for rt is for programmatic locale messages translation with using tm, v-for, javascript for statement.

WARNING

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.

See about:

Call Signature ​

ts
ComposerResolveLocaleMessageTranslation(
   message, 
   list, 
   options?): string;

Resolve locale message translation for list interpolations

Parameters ​

ParameterTypeDescription
message| VueMessageType | MessageFunction<VueMessageType>A target locale message to be resolved. You will need to specify the locale message returned by tm.
listunknown[]A values of list interpolation.
options?TranslateOptions<Locales>Additional options for translation

Returns ​

string

Translated message

Remarks ​

Overloaded rt.

In this overloaded rt, return a pluralized translation message.

TIP

The use-case for rt is for programmatic locale messages translation with using tm, v-for, javascript for statement.

WARNING

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.

See about:

Call Signature ​

ts
ComposerResolveLocaleMessageTranslation(
   message, 
   named, 
   options?): string;

Resolve locale message translation for named interpolations

Parameters ​

ParameterTypeDescription
message| VueMessageType | MessageFunction<VueMessageType>A target locale message to be resolved. You will need to specify the locale message returned by tm.
namedNamedValueA values of named interpolation.
options?TranslateOptions<Locales>Additional options for translation

Returns ​

string

Translated message

Remarks ​

Overloaded rt.

In this overloaded rt, for each placeholder x, the locale messages should contain a {x} token.

TIP

The use-case for rt is for programmatic locale messages translation with using tm, v-for, javascript for statement.

WARNING

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.

See about:

Released under the MIT License.