Wiki source code of Front-end localization Vue adapter
Last modified by Manuel Leduc on 2026/03/26 17:58
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | == useI18nAdapter == | ||
| 2 | |||
| 3 | Vue composer that takes a [[resolver>>doc:documentation.xs.dev.front-end.localization.api.WebHome||anchor="HResolver"]] and a query, a returns an object with two keys: | ||
| 4 | |||
| 5 | * ##isLoading##: a reactive value that becomes false once the requested translations are done | ||
| 6 | * ##t##: a [[vue-i18n>>https://vue-i18n.intlify.dev/api/composition.html#t]] locale translation function | ||
| 7 | |||
| 8 | {{code language="typescript"}} | ||
| 9 | useRemoteI18n( | ||
| 10 | resolver: Resolver, | ||
| 11 | query: Query, | ||
| 12 | ): { | ||
| 13 | isLoading: Ref<boolean>; | ||
| 14 | t: ComposerTranslation< | ||
| 15 | {}, | ||
| 16 | string, | ||
| 17 | RemoveIndexSignature< | ||
| 18 | { [key: string]: LocaleMessageValue<VueMessageType> }, | ||
| 19 | >, | ||
| 20 | never, | ||
| 21 | never, | ||
| 22 | never, | ||
| 23 | >; | ||
| 24 | } | ||
| 25 | {{/code}} | ||
| 26 | |||
| 27 | === Parameters === | ||
| 28 | |||
| 29 | * ##resolver##: the resolver to use to load the translations. | ||
| 30 | * ##query##: the query to execute |