# General Translation Platform: CustomMapping
URL: https://generaltranslation.com/ja/docs/platform/core/reference/types/custom-mapping.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: カスタムロケールマッピングとロケールプロパティのオーバーライド。CustomMapping 型の API リファレンス。

`CustomMapping` は、標準の BCP-47 ロケール情報を拡張または上書きするための、カスタムのロケールコードマッピングとメタデータを定義します。General Translation の [Constructor](/docs/platform/core/reference/gt-class/constructor) の `customMapping` オプション、または [`GTConstructorParams`](/docs/platform/core/reference/types/gt-constructor-params) で指定します。

## 概要 [#overview]

`CustomMapping` は、カスタムロケールコードまたはエイリアスをキーとするレコードです。各値は、表示名の文字列か、特定のロケールメタデータを上書きする部分的な [`LocaleProperties`](/docs/platform/core/reference/types/locale-properties) オブジェクトのいずれかです。

```typescript
type CustomMapping = Record<string, string | Partial<LocaleProperties>>;
```

カスタムマッピングは GT インスタンスの初期化時に解決され、標準の BCP-47 によるロケール解決よりも優先されます。

## 構造 [#structure]

* **キー** — `'simplified-chinese'` や `'company-english'` のような、カスタムのロケールコードまたはエイリアス。
* **値** — シンプルな表示名の `string`、または `Partial<LocaleProperties>` オブジェクト。

| 値の型                         | 説明             | 例                                                   |
| --------------------------- | -------------- | --------------------------------------------------- |
| `string`                    | シンプルな表示名。      | `'Simplified Chinese'`                              |
| `Partial<LocaleProperties>` | ロケールメタデータのオーバーライド。 | `{ code: 'zh-CN', name: 'Chinese', emoji: '🇨🇳' }` |

## 例 [#example]

```typescript
// シンプルな文字列マッピング: エイリアス -> 表示名
const simpleMapping: CustomMapping = {
  'english': 'English',
  'spanish': 'Spanish',
  'mexican-spanish': 'Mexican Spanish'
};

const gt = new GT({
  sourceLocale: 'english',
  targetLocale: 'spanish',
  customMapping: simpleMapping
});
```

```typescript
// ロケールメタデータのオーバーライド（拡張）
const enhancedMapping: CustomMapping = {
  'simplified-chinese': {
    code: 'zh-CN',
    name: 'Simplified Chinese',
    nativeName: '简体中文',
    regionName: 'China',
    emoji: '🇨🇳'
  }
};
```

## メモ [#notes]

* カスタムマッピングは標準の BCP-47 ロケール解決を上書きするため、エイリアスを使うと標準のロケール検証を回避できます (たとえば、`zh` のエイリアスとして `cn` を使用する場合) 。
* string 値はシンプルな表示名を提供します。`Partial<LocaleProperties>` 値を使うと、カスタム名や emoji など、ロケールを細かくカスタマイズできます。
* カスタムマッピングは GT インスタンスの初期化時に解決されます。
* リージョンレベルのオーバーライドについては、[`getRegionProperties`](/docs/platform/core/reference/gt-class-methods/locales/get-region-properties) が別の `CustomRegionMapping` 型を受け付けます。

## Sitemap

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