# generaltranslation: General Translation Core SDK: FileToTranslate
URL: https://generaltranslation.com/zh/docs/core/types/file-to-translate.mdx
---
title: FileToTranslate
description: 批量文件翻译操作中使用的文件对象类型定义
---
## 概述
此类型已弃用。当前 API 使用 `FileToUpload` 上传文件 (通过 [`uploadSourceFiles`](/docs/core/class/methods/translation/upload-source-files)) ,并使用 `FileReferenceIds` 将翻译加入队列 (通过 [`enqueueFiles`](/docs/core/class/methods/translation/enqueue-files)) 。
`FileToTranslate` 之前用于表示一个文件对象,以执行批量翻译处理。
```typescript
type FileToTranslate = {
content: string;
fileName: string;
fileFormat: FileFormat;
formatMetadata?: Record;
dataFormat?: DataFormat;
};
```
## 属性
| 属性 | 类型 | 必填 | 说明 |
| ----------------- | --------------------- | ----- | -------- |
| `content` | `string` | **是** | 原始文件内容 |
| `fileName` | `string` | **是** | 文件标识符 |
| `fileFormat` | `FileFormat` | **是** | 文件格式 |
| `formatMetadata?` | `Record` | 否 | 格式专用元数据 |
| `dataFormat?` | `DataFormat` | 否 | 文件内的数据格式 |
### 相关类型
```typescript
type FileFormat = 'JSON' | 'PO' | 'POT' | 'MDX' | 'MD' | 'HTML' | 'TXT' | string;
type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';
```
## 示例
### JSON 文件
```typescript copy
import { FileToTranslate } from 'generaltranslation';
const jsonFile: FileToTranslate = {
content: JSON.stringify({
"welcome": "Welcome",
"save": "Save"
}),
fileName: 'common.json',
fileFormat: 'JSON',
dataFormat: 'I18NEXT'
};
```
### MDX 文件
```typescript copy
const mdxFile: FileToTranslate = {
content: `# Getting Started\n\nWelcome to our platform!`,
fileName: 'docs/start.mdx',
fileFormat: 'MDX',
dataFormat: 'JSX'
};
```
## 相关类型
* [`EnqueueFilesOptions`](/docs/core/types/enqueue-files-options) - 批处理选项