# vue: MessagesFunction URL: https://generaltranslation.com/en-GB/docs/vue/reference/types/messages-function.mdx --- title: MessagesFunction description: Resolve registered messages, raw strings, and nullish values from the active catalogue. API reference for MessagesFunction. --- [`useMessages()`](/docs/vue/reference/composables/use-messages) returns this callback. It decodes values created by [`msg()`](/docs/vue/reference/functions/msg) and also accepts an ordinary source string. ## Overview [#overview] ```ts type MessagesFunction = ( message: T, options?: GTStringOptions ) => T extends string ? string : T; ``` | Parameter | Description | Type | Optional | Default | | --------------------- | ----------------------------------------------------------- | ---------------------------------------------------------------- | -------- | ------- | | [`message`](#message) | Encoded message, raw source string, `null`, or `undefined`. | `T extends string \| null \| undefined` | No | — | | [`options`](#options) | Context for a raw source string. | [`GTStringOptions`](/docs/vue/reference/types/gt-string-options) | Yes | `{}` | ## Parameters [#parameters] ### `message` **Type** `T extends string | null | undefined` · **Required** Pass a value returned by [`msg()`](/docs/vue/reference/functions/msg), an ordinary source string, or a nullish value. Encoded strings carry their original source, hash, and optional `$context`. ### `options` **Type** [`GTStringOptions`](/docs/vue/reference/types/gt-string-options) · **Optional** · **Default** `{}` For a raw string, `$context` contributes to the catalogue hash. For an encoded value, metadata stored by [`msg()`](/docs/vue/reference/functions/msg) takes precedence, and call-site options are ignored. ## Return value [#returns] | Input | Return type | Behaviour | | ----------- | ----------- | ------------------------------------------------------------- | | `string` | `string` | Returns the catalogue translation or decoded source fallback. | | `null` | `null` | Returns `null` unchanged. | | `undefined` | `undefined` | Returns `undefined` unchanged. | The conditional generic preserves nullish input types, allowing optional messages to pass through without a separate guard. ## Resolution [#resolution] For an encoded message, the callback decodes the stored source, `$context`, and precomputed hash before performing a lookup. For an ordinary string, it calculates the hash from the string and call-site `$context`. Both paths require a string value in the active catalogue. Missing or non-string entries return the source text. No ICU formatting or interpolation is performed; braces remain literal. Call the callback from a Vue template, computed value, or reactive effect when the result should update after a [`createGT()`](/docs/vue/reference/functions/create-gt) plugin loads a catalogue or changes locale. ## Example [#example] ```vue title="src/PageTitle.vue" ```