Wiki source code of Front-end localization Vue adapter
Last modified by Manuel Leduc on 2026/08/26 11:43
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | == useI18nAdapter == | ||
| 2 | |||
| 3 | Vue composer that takes a resolver and a query and 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 | export function useI18nAdapter(resolver: Resolver, query: Query): { | ||
| 10 | t: Composer["t"]; | ||
| 11 | isLoading: Ref<boolean>; | ||
| 12 | }; | ||
| 13 | {{/code}} | ||
| 14 | |||
| 15 | === Parameters === | ||
| 16 | |||
| 17 | * ##resolver##: the resolver to use to load the translations. In an XWiki page, this is the ##resolver## exported by the [[localization WebJar>>doc:documentation.xs.dev.front-end.localization.webjar.WebHome]]. | ||
| 18 | * ##query##: the query to execute |