vue-i18n / general / ComposerResolveLocaleMessageTranslation
Interface: ComposerResolveLocaleMessageTranslation()<Locales>
Vue I18n Composition
Resolve locale message translation functions
Remarks
This is the interface for Composer
Type Parameters
| Type Parameter | Default type |
|---|---|
Locales | "en-US" |
Call Signature
ComposerResolveLocaleMessageTranslation(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.
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
ComposerResolveLocaleMessageTranslation(
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<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
ComposerResolveLocaleMessageTranslation(
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<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
ComposerResolveLocaleMessageTranslation(
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<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: