# Vue: CreateGTOptions
URL: https://generaltranslation.com/en-GB/docs/vue/reference/types/create-gt-options.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Configure an isolated Vue plugin's initial locale, cookie and catalogue loader. API reference for CreateGTOptions.

Pass this object to [`createGT()`](/docs/vue/reference/functions/create-gt). Its fields apply to reactive client plugins and request-scoped server plugins.

## Overview [#overview]

```ts
type CreateGTOptions = {
  customMapping?: CustomMapping;
  defaultLocale?: string;
  loadTranslations?: LoadTranslations;
  locale?: string;
  localeCookieName?: string;
};
```

| Option                                   | Description                                         | Type                                                                  | Optional | Default                      |
| ---------------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------- | -------- | ---------------------------- |
| [`customMapping`](#custom-mapping)       | Locale aliases for formatting and plural selection. | [`CustomMapping`](/docs/platform/core/reference/types/custom-mapping) | Yes      | None                         |
| [`defaultLocale`](#default-locale)       | Source and fallback locale.                         | `string`                                                              | Yes      | `en`                         |
| [`loadTranslations`](#load-translations) | Asynchronous target-catalogue loader.               | [`LoadTranslations`](/docs/vue/reference/types/load-translations)     | Yes      | Empty catalogue              |
| [`locale`](#locale)                      | Explicit initial locale.                            | `string`                                                              | Yes      | Cookie, then `defaultLocale` |
| [`localeCookieName`](#cookie-name)       | Browser cookie used to persist locale selection.    | `string`                                                              | Yes      | `generaltranslation.locale`  |

## `customMapping` [#custom-mapping]

**Type** [`CustomMapping`](/docs/platform/core/reference/types/custom-mapping) · **Optional** · **Default** none

Locale aliases used for locale-sensitive formatting and plural selection. An object mapping with a valid `code` changes the locale passed to `Intl` formatters and plural rules.

Catalogue loading and the locale cookie keep the original alias. For example, setting `pirate: { code: 'fr-FR' }` loads the `pirate` catalogue and persists `pirate`, while formatting values with French rules.

## `defaultLocale` [#default-locale]

**Type** `string` · **Optional** · **Default** `en`

The locale of the source content and the fallback when no explicit or saved locale exists. Its source text acts as the catalogue, so the plugin never calls [`loadTranslations`](/docs/vue/reference/types/load-translations) for this locale.

The value is not canonicalised or restricted by [`createGT()`](/docs/vue/reference/functions/create-gt). Use the same spelling in your CLI configuration, loader paths and request locale resolution.

## `loadTranslations` [#load-translations]

**Type** [`LoadTranslations`](/docs/vue/reference/types/load-translations) · **Optional** · **Default** empty catalogue

An asynchronous callback that returns the complete [`TranslationCatalog`](/docs/vue/reference/types/translation-catalog) for a target locale. When omitted, every target load resolves to `{}`, so source content remains visible.

Successful results are cached per plugin, and concurrent calls for one locale share a promise. Rejections are logged and rethrown without being cached.

## `locale` [#locale]

**Type** `string` · **Optional** · **Default** browser cookie, then `defaultLocale`

Explicitly sets the initial active locale. On the server, pass the locale resolved for the current request. In the browser, an explicit value takes precedence over a stale locale cookie and is written back to it, keeping hydration consistent.

When omitted in a browser, the saved cookie takes precedence over `defaultLocale`. When omitted on the server, `defaultLocale` is used.

## `localeCookieName` [#cookie-name]

**Type** `string` · **Optional** · **Default** `generaltranslation.locale`

Names the path-wide session cookie used to persist and read the active locale. Override it when routing or server middleware uses a different cookie name.

Direct browser cookie writes are visible to `plugin.getLocale()` and the next Vue render, but the browser does not emit an event to schedule that render. Use `plugin.setLocale()` or [`useSetLocale()`](/docs/vue/reference/composables/use-set-locale) for reactive changes.

## Example [#example]

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

const options: CreateGTOptions = {
  customMapping: {
    pirate: { code: 'fr-FR' },
  },
  defaultLocale: 'en',
  locale: requestLocale,
  localeCookieName: 'my-app.locale',
  loadTranslations: async (locale) =>
    (await import(`./_gt/${locale}.json`)).default,
};
```

Create a separate options object and plugin for each server request. Sharing plugin state or a mutable catalogue cache outside the plugin can leak locale-specific data between requests.

## Sitemap

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