# generaltranslation: General Translation Core SDK: getProjectData URL: https://generaltranslation.com/ja/docs/core/class/methods/translation/get-project-data.mdx --- title: getProjectData description: プロジェクト情報と設定を取得するための getProjectData メソッドのAPIリファレンス --- ## 概要 `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(', ')}`); ``` ## リファレンス ### パラメータ | 名前 | 型 | 説明 | | ----------- | ---------------------- | ------------------ | | `projectId` | `string` | 取得対象のプロジェクトの一意の識別子 | | `options?` | `{ timeout?: number }` | リクエストの省略可能な設定 | #### オプション | 名前 | 型 | 説明 | | ---------- | -------- | --------------------- | | `timeout?` | `number` | リクエストのタイムアウト時間 (ミリ秒) | ### 戻り値 `Promise` - プロジェクト情報と設定を含みます。 ```typescript type ProjectData = { id: string; name: string; orgId: string; defaultLocale: string; currentLocales: string[]; } ``` | プロパティ | 型 | 説明 | | ---------------- | ---------- | -------------------- | | `id` | `string` | 一意のプロジェクト識別子 | | `name` | `string` | 人が読める形式のプロジェクト名 | | `orgId` | `string` | プロジェクトを所有する組織の識別子 | | `defaultLocale` | `string` | プロジェクトのデフォルトのソースロケール | | `currentLocales` | `string[]` | 現在設定されている対象ロケールの配列 | *** ## 例 ### 基本的な使い方 ```typescript title="index.ts" copy 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'); ``` *** ## 注記 * このメソッドはプロジェクト情報への読み取り専用アクセスを提供します。プロジェクト設定を変更するには、ダッシュボードを使用してください * このメソッドを使用するには有効なプロジェクト ID が必要です。指定した API キーでそのプロジェクトにアクセスできる必要があります * プロジェクトデータには、ソース ロケールと対象ロケールの両方の設定が含まれます * `currentLocales` 配列は、プロジェクトに設定されているすべての対象ロケールを表します * 翻訳ワークフローを開始する前に、このメソッドを使用してプロジェクト設定を検証してください ## 次のステップ * プロジェクトのセットアップを行うには [`setupProject`](/docs/core/class/methods/translation/setup-project) を参照してください * 翻訳ジョブを開始するには [`enqueueFiles`](/docs/core/class/methods/translation/enqueue-files) を参照してください * ファイル固有の情報については [`querySourceFile`](/docs/core/class/methods/translation/query-source-file) を参照してください