# generaltranslation: General Translation Core SDK: TranslateManyResult URL: https://generaltranslation.com/zh/docs/core/types/translate-many-result.mdx --- title: TranslateManyResult description: 批量翻译操作返回结果的类型定义 --- ## 概述 `TranslateManyResult` 表示使用 [`translateMany`](/docs/core/class/methods/translation/translate-many) 执行批量翻译操作后的结果。 ```typescript type TranslateManyResult = TranslationResult[]; ``` 它是一个由 [`TranslationResult`](/docs/core/types/translation-result) 对象组成的数组,顺序与输入条目保持一致。 ## 结构 ```typescript type TranslationResult = RequestSuccess | TranslationError; type RequestSuccess = TypedResult & { success: true; locale: string; }; type TranslationError = { success: false; error: string; code: number; }; ``` 每个元素要么是成功结果,要么是错误,可通过 `success` 属性区分。 ## 示例 ### 基本用法 ```typescript copy import { GT, TranslateManyResult } from 'generaltranslation'; const gt = new GT({ apiKey: 'your-api-key', projectId: 'your-project-id' }); const results: TranslateManyResult = await gt.translateMany( ['Hello', 'Goodbye'], 'es' ); ``` ### 错误处理 ```typescript copy results.forEach((result, index) => { if (result.success) { console.log(`Entry ${index}: ${result.translation}`); } else { console.error(`Entry ${index} failed: ${result.error}`); } }); ``` ## 相关类型 * [`TranslationResult`](/docs/core/types/translation-result) - 单个结果的结构 * [`translateMany`](/docs/core/class/methods/translation/translate-many) - 返回此类型的方法