# General Translation Platform: getProjectData URL: https://generaltranslation.com/ja/docs/platform/core/reference/gt-class-methods/translation/get-project-data.mdx --- title: getProjectData description: プロジェクトレベルのメタデータと翻訳設定を取得します。getProjectData の API リファレンス。 --- General Translation で翻訳プロジェクトの情報 (名前、Organization、デフォルトロケール、現在設定されている対象ロケールなど) を取得します。プロジェクト設定の確認や検証に使用できます。 ## 概要 [#overview] プロジェクト ID を指定して `getProjectData` を呼び出します。読み取り専用のプロジェクトメタデータとロケール設定が返されます。 ```typescript const gt = new GT({ projectId: 'your-project-id', apiKey: 'your-api-key' }); const projectData = await gt.getProjectData('project-123'); console.log(`Project: ${projectData.name}`); console.log(`Default locale: ${projectData.defaultLocale}`); console.log(`Target locales: ${projectData.currentLocales.join(', ')}`); ``` シグネチャ: ```typescript getProjectData( projectId: string, options?: { timeout?: number } ): Promise ``` *注: `getProjectData` を使用するには、GT インスタンスに `apiKey` (または `devApiKey`) と `projectId` が設定されており、その API Key で当該プロジェクトにアクセスできる必要があります。* ## 仕組み [#how-it-works] * **読み取り専用。** このメソッドはプロジェクト情報への読み取り専用アクセスを提供します。プロジェクト設定を変更する場合は、ダッシュボードを使用してください。 * **ロケール設定。** レスポンスには、ソース (`defaultLocale`) と対象 (`currentLocales`) の両方のロケール設定が含まれます。 * **検証。** 翻訳ワークフローを開始する前に、プロジェクト設定の検証に使用できます。 ## パラメータ [#parameters] | パラメータ | 説明 | 型 | 任意 | デフォルト | | -------------------------- | -------------------- | ---------------------- | --- | ----- | | [`projectId`](#project-id) | 取得するプロジェクトの一意の識別子です。 | `string` | いいえ | — | | [`options`](#options) | リクエストの構成です。 | `{ timeout?: number }` | はい | — | ### `projectId` [#project-id] **型** `string` · **必須** 取得するプロジェクトの一意の識別子です。指定された API Key でそのプロジェクトにアクセスできる必要があります。 ### `options` [#options] **Type** `{ timeout?: number }` · **任意** | フィールド | 説明 | Type | 任意 | | --------- | ---------------------- | -------- | -- | | `timeout` | リクエストのタイムアウト時間 (ミリ秒) 。 | `number` | はい | ## 戻り値 [#returns] **型** `Promise` プロジェクトを表す `ProjectData` オブジェクトに解決されます: ```typescript type ProjectData = { id: string; name: string; orgId: string; defaultLocale: string; currentLocales: string[]; }; ``` | プロパティ | 説明 | Type | | ---------------- | --------------------- | ---------- | | `id` | 一意のプロジェクト識別子。 | `string` | | `name` | 人が読んでわかるプロジェクト名。 | `string` | | `orgId` | このプロジェクトを所有する組織の識別子。 | `string` | | `defaultLocale` | プロジェクトのデフォルトのソースロケール。 | `string` | | `currentLocales` | 現在設定されている対象ロケール。 | `string[]` | ## 例 [#examples] ```typescript title="index.ts" import { GT } from 'generaltranslation'; const gt = new GT({ projectId: 'your-project-id', apiKey: 'your-api-key', }); async function getProjectInfo(projectId: string) { try { const project = await gt.getProjectData(projectId); console.log('=== Project Information ==='); console.log(`ID: ${project.id}`); console.log(`Name: ${project.name}`); console.log(`Organization: ${project.orgId}`); console.log(`Default Locale: ${project.defaultLocale}`); console.log(`Target Locales: ${project.currentLocales.join(', ')}`); return project; } catch (error) { console.error(`Failed to retrieve project ${projectId}:`, error); throw error; } } const projectInfo = await getProjectInfo('my-project-123'); ``` ## メモ [#notes] * このメソッドはプロジェクト情報への読み取り専用アクセスを提供します。プロジェクト設定を変更するには、ダッシュボードを使用してください。 * このメソッドには有効な プロジェクト ID が必要です。指定されたAPIキーでそのプロジェクトにアクセスできる必要があります。 * プロジェクトデータには、source と対象ロケールの両方の設定が含まれます。 * `currentLocales` 配列は、プロジェクトに設定されているすべての対象ロケールを表します。 * 翻訳ワークフローを開始する前に、このメソッドを使用してプロジェクト設定を検証してください。