# Vue: TranslationCatalog
URL: https://generaltranslation.com/ja/docs/vue/reference/types/translation-catalog.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 1 つのロケールにおけるすべてのプレーン文字列およびリッチコンテンツの翻訳を表します。TranslationCatalog の API リファレンス。

CLI は、このハッシュをキーとするオブジェクトを生成します。[`LoadTranslations`](/docs/vue/reference/types/load-translations) コールバックはこれをプラグインに返します。通常、アプリケーションコードでは、カタログを直接参照するのではなく、翻訳コンポーネントとコンポーザブルを介して利用します。

## 概要 [#overview]

```ts
import type { JsxChildren } from 'generaltranslation/types';

type TranslationCatalog = Record<string, JsxChildren>;
```

| メンバー              | 説明                                       | 型                                                                 |
| ----------------- | ---------------------------------------- | ----------------------------------------------------------------- |
| [`hash`](#hash)   | ソースコンテンツと翻訳メタデータから生成される、安定したカタログキー。      | `string`                                                          |
| [`value`](#value) | プレーンな `STRING` 翻訳、またはシリアル化されたリッチコンテンツ翻訳。 | [`JsxChildren`](/docs/platform/core/reference/types/jsx-children) |

## メンバー [#members]

### `hash`

**型** `string` · **必須**

各プロパティキーは、抽出された1つのソースエントリを識別します。プレーンな文字列の識別情報には、ソース文字列と任意の`$context`が含まれます。リッチコンテンツの識別情報には、構造化されたソースと[`<T>`](/docs/vue/reference/components/t)のメタデータも含まれます。

hashは不透明な値として扱ってください。生成と更新は`gt` CLIに任せてください。ソースコンテンツまたはhashに影響するメタデータを変更すると、別のkeyが生成されます。

### `value`

**型** [`JsxChildren`](/docs/platform/core/reference/types/jsx-children) · **必須**

プレーンな `STRING` エントリには翻訳文字列が格納されます。リッチな [`<T>`](/docs/vue/reference/components/t) エントリには、Vue レンダラーが使用するシリアル化されたコンテンツツリーが格納されます。

公開ワイヤ型には、生成されたカタログで使用されるすべてのスカラー型が含まれます。

```ts
type JsxChildren = boolean | null | JsxChild | JsxChild[];
type JsxChild = string | JsxElement | Variable;
```

ブール値と `null` 値は、ネストされた element や branch の content を含め、スカラーのリッチコンテンツ値として使用できます。作成する child array には、より限定的な `JsxChild[]` shape を使用します。シリアル化された element または variable の Record を手作業で作成しないでください。これらのインデックスとメタデータは、抽出された source tree と一致する必要があります。

## 参照の動作 [#lookup-behavior]

[`useGT()`](/docs/vue/reference/composables/use-gt)、[`t()`](/docs/vue/reference/functions/t)、および [`useMessages()`](/docs/vue/reference/composables/use-messages) は、プレーン文字列の参照では、カタログ 内の文字列値のみを受け付けます。キーが存在しない場合や値が文字列以外の場合は、ソース文字列にフォールバックします。

[`<T>`](/docs/vue/reference/components/t) はリッチ値を使用し、一致する翻訳がない場合はソーススロットにフォールバックします。デフォルトロケールでは、ソースコンテンツがフォールバックとなるため、カタログ は必要ありません。

## 例 [#example]

生成された JSON オブジェクトをカタログとして返します。

```ts title="src/loadTranslations.ts"
import type { LoadTranslations, TranslationCatalog } from 'gt-vue';

const loadTranslations: LoadTranslations = async (locale) => {
  const module = await import(`./_gt/${locale}.json`);
  return module.default as TranslationCatalog;
};

export default loadTranslations;
```

ロケールにカタログがない場合にソースコンテンツをレンダリングするには、`{}` を返します。

## Sitemap

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