# Vue: GTStringOptions
URL: https://generaltranslation.com/ja/docs/vue/reference/types/gt-string-options.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 静的コンテキストを使用して、プレーン文字列のカタログ参照を区別します。GTStringOptions の API リファレンス。

このオプションオブジェクトは、[`useGT()`](/docs/vue/reference/composables/use-gt)、[`t()`](/docs/vue/reference/functions/t)、[`msg()`](/docs/vue/reference/functions/msg)、および [`useMessages()`](/docs/vue/reference/composables/use-messages) の生文字列呼び出しで共通して使用されます。

## 概要 [#overview]

```ts
type GTStringOptions = {
  $context?: string;
};
```

| Property               | 説明                             | 型     | 任意 | デフォルト |
| ---------------------- | ------------------------------ | -------- | -- | ------- |
| [`$context`](#context) | カタログハッシュの計算時に、同一のソース文字列を識別します。 | `string` | はい | —       |

## `$context` [#context]

**型** `string` · **任意** · **デフォルト** —

同じソーステキストでも状況によって異なる翻訳が必要な場合は、コンテキストを使用します。

```ts
gt('Open', { $context: 'button that opens a file' });
gt('Open', { $context: 'adjective for an available store' });
```

コンテキストはカタログの識別情報に影響しますが、表示はされません。CLIとランタイムで同じキーが計算されるよう、抽出された呼び出しでは固定値にしてください。

## サポートされないオプション [#unsupported]

Vue のプレーン文字列の参照では、補間変数、`$format`、`$locale`、`$maxChars`、`$requiresReview` を意図的に受け付けません。また、ICU 構文も解析しません。波括弧などのメッセージ形式の文字はリテラルとして扱われます。

ランタイム値には、[`<Var>`](/docs/vue/reference/components/var) とともに [`<T>`](/docs/vue/reference/components/t) を使用してください。リッチな翻訳メタデータは `GTStringOptions` ではなく、[`<T>`](/docs/vue/reference/components/t) に指定します。

## 例 [#example]

```vue title="src/AccountStatus.vue"
<script setup lang="ts">
import { useGT } from 'gt-vue';

const gt = useGT();
</script>

<template>
  <span>{{ gt('Active', { $context: 'account status' }) }}</span>
</template>
```

## Sitemap

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