useText function

Module @runic-artifex/vue in @runic-artifex/vue 0.23.0

function useText(source: MaybeRefOrGetter<TextReference | FieldError | string | null | undefined>, fallback?: MaybeRefOrGetter<string | undefined>): ComputedRef<string>;

A text reference that a ViewModel produced, such as a status line or a validation message's text, in the window's language (resolveText), as a computed ref that follows a language switch until the effect scope stops. source and fallback may be refs or getters: useText(() => view.state.value?.status). A string shows as it is; null and undefined show fallback. Configure the page's Translations runtime once with configureTranslatedText; without one, a reference shows its fallback text. A field's FieldError shows the application's text for it (configureFieldErrorText), or its English message: useText(() => title.error).

const status = useText(() => view.state.value?.status);
<p>{{ status }}</p>