# generaltranslation: General Translation Core SDK: 変数 URL: https://generaltranslation.com/ja/docs/core/types/Variable.mdx --- title: 変数 description: 翻訳コンテンツで使用する変数の型定義 --- ## 概要 `Variable` は、翻訳内の動的コンテンツを表すプレースホルダーです。 ```typescript type Variable = { k: string; i?: number; v?: VariableType; }; ``` ## プロパティ | プロパティ | 型 | 説明 | | ----- | -------------- | ------ | | `k` | `string` | 変数のキー名 | | `i?` | `number` | 内部識別子 | | `v?` | `VariableType` | 書式の種類 | ### VariableType ```typescript type VariableType = 'v' | 'n' | 'd' | 'c'; ``` | 値 | 説明 | | ----- | ----------- | | `'v'` | プレーンテキストの置換 | | `'n'` | 数値の書式設定 | | `'d'` | 日付の書式設定 | | `'c'` | 通貨の書式設定 | ## 例 ### 基本的な使い方 ```typescript copy import { Variable } from 'generaltranslation'; // テキスト変数 const nameVariable: Variable = { k: 'userName' }; // 数値変数 const countVariable: Variable = { k: 'itemCount', v: 'n' }; // 通貨変数 const priceVariable: Variable = { k: 'price', v: 'c' }; ``` ### JSX 内のコンテンツ ```typescript copy const welcomeContent = [ 'Welcome back, ', { k: 'userName' } as Variable, '! You have ', { k: 'messageCount', v: 'n' } as Variable, ' messages.' ]; ``` ## 関連する型 * [`VariableType`](/docs/core/types/variable-type) - 書式の型指定