# Vue: GTFunction
URL: https://generaltranslation.com/en-US/docs/vue/reference/types/gt-function.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Describe the synchronous callback used for Vue plain-string catalog 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 catalog 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 disambiguates identical source strings.

## Return value [#returns]

**Type** `string`

Returns the active catalog's string value for the calculated hash. A missing entry or non-string catalog value returns `message` unchanged.

The lookup is synchronous and does not perform network work, 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 catalog. |
| [`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 evaluate 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 initialization finishes also throws.

## Example [#example]

```ts
import type { GTFunction } from 'gt-vue';

function translateNavigation(gt: GTFunction) {
  return {
    home: gt('Home'),
    settings: gt('Settings'),
  };
}
```

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
