# General Translation Platform: TranslateManyResult URL: https://generaltranslation.com/zh/docs/platform/core/reference/types/translate-many-result.mdx --- title: TranslateManyResult description: 批量翻译返回的结果数组。TranslateManyResult 类型的 API 参考。 --- `TranslateManyResult` 是 [`translateMany`](/docs/platform/core/reference/gt-class-methods/translation/translate-many) 返回的值。它是一个由 [`TranslationResult`](/docs/platform/core/reference/types/translation-result) 对象组成的数组,其顺序与输入的 entries 一致。 ## 概览 [#overview] `TranslateManyResult` 是一个由翻译结果组成的数组。每个元素要么表示成功,要么表示错误,可通过其 `success` 属性区分。 ```typescript type TranslateManyResult = TranslationResult[]; ``` 每个元素都符合 [`TranslationResult`](/docs/platform/core/reference/types/translation-result) 的结构: ```typescript type TranslationResult = RequestSuccess | TranslationError; type RequestSuccess = TypedResult & { success: true; locale: string; }; type TranslationError = { success: false; error: string; code: number; }; ``` ## 示例 [#example] ```typescript import { GT } from 'generaltranslation'; import { TranslateManyResult } from 'generaltranslation/types'; const gt = new GT({ apiKey: 'your-api-key', projectId: 'your-project-id' }); const results: TranslateManyResult = await gt.translateMany( ['Hello', 'Goodbye'], 'es' ); ``` ```typescript // 根据 success 属性对每个元素进行类型收窄 results.forEach((result, index) => { if (result.success) { console.log(`Entry ${index}: ${result.translation}`); } else { console.error(`Entry ${index} failed: ${result.error}`); } }); ```