# vue: GTFunction URL: https://generaltranslation.com/en-GB/docs/vue/reference/types/gt-function.mdx --- title: GTFunction description: Describes the synchronous callback used for Vue plain-string catalogue lookups. API reference for GTFunction. --- The callback returned by [`useGT()`](/docs/vue/reference/composables/use-gt) and the module-level [`t()`](/docs/vue/reference/functions/t) export share this signature. Their state ownership and availability differ, but their lookup result is the same. ## Overview [#overview] ```ts type GTFunction = ( message: string, options?: GTStringOptions ) => string; ``` | Parameter | Description | Type | Optional | Default | | --------------------- | -------------------------------------------- | ---------------------------------------------------------------- | -------- | ------- | | [`message`](#message) | Source string to translate. | `string` | No | — | | [`options`](#options) | Optional context used in the catalogue hash. | [`GTStringOptions`](/docs/vue/reference/types/gt-string-options) | Yes | `{}` | ## Parameters [#parameters] ### `message` **Type** `string` · **Required** The literal source text used to calculate a plain `STRING` hash. Braces remain part of that text; they are not interpolation placeholders. ### `options` **Type** [`GTStringOptions`](/docs/vue/reference/types/gt-string-options) · **Optional** · **Default** `{}` Only `$context` is supported. It distinguishes between identical source strings. ## Return value [#returns] **Type** `string` Returns the string value from the active catalogue for the calculated hash. If the entry is missing or the catalogue value is not a string, returns `message` unchanged. The lookup is synchronous and does not perform network operations, ICU processing, or interpolation. ## Implementations [#implementations] | API | State source | Locale updates | | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | [`useGT()`](/docs/vue/reference/composables/use-gt) | The [`GTPlugin`](/docs/vue/reference/types/gt-plugin) installed on the current Vue app. | Call the callback from a template, computed value or reactive effect to rerun after a reactive plugin changes locale or loads a catalogue. | | [`t()`](/docs/vue/reference/functions/t) | The browser-global runtime created by [`initializeGTSPA()`](/docs/vue/reference/functions/initialize-gt-spa). | Module-level results update only after the SPA locale setter reloads the page and modules are evaluated again. | Calling [`useGT()`](/docs/vue/reference/composables/use-gt) without an installed plugin throws when the composable tries to access state. Calling [`t()`](/docs/vue/reference/functions/t) on the server or before SPA initialisation is complete also throws. ## Example [#example] ```ts import type { GTFunction } from 'gt-vue'; function translateNavigation(gt: GTFunction) { return { home: gt('Home'), settings: gt('Settings'), }; } ```