# General Translation Platform: FileToTranslate (legacy)
URL: https://generaltranslation.com/en-GB/docs/platform/core/reference/types/file-to-translate.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Review the legacy file input removed from Core v9 and its current replacement. API reference for FileToTranslate.

`FileToTranslate` represented a file object in Core 8.x batch translation workflows. It is not exported by `generaltranslation` 9.x.

<Callout type="info">
  **Changed in v9:** `FileToTranslate` was removed. Use `FileUpload` for [`uploadSourceFiles`](/docs/platform/core/reference/gt-class-methods/translation/upload-source-files), then pass the returned file references to [`enqueueFiles`](/docs/platform/core/reference/gt-class-methods/translation/enqueue-files).
</Callout>

## Overview [#overview]

The legacy type bundled a file&#39;s raw content, name, and format:

```typescript
type FileToTranslate = {
  content: string;
  fileName: string;
  fileFormat: FileFormat;
  formatMetadata?: Record<string, any>;
  dataFormat?: DataFormat;
};
```

## Properties [#properties]

| Property                             | Description                    | Type                                                            | Optional |
| ------------------------------------ | ------------------------------ | --------------------------------------------------------------- | -------- |
| [`content`](#content)                | Raw file content.              | `string`                                                        | No       |
| [`fileName`](#file-name)             | File identifier.               | `string`                                                        | No       |
| [`fileFormat`](#file-format)         | Legacy file-format identifier. | string union                                                    | No       |
| [`formatMetadata`](#format-metadata) | Format-specific metadata.      | `Record<string, any>`                                           | Yes      |
| [`dataFormat`](#data-format)         | Data format within the file.   | [`DataFormat`](/docs/platform/core/reference/types/data-format) | Yes      |

### `content` [#content]

**Type** `string` · **Required**

Raw file content.

### `fileName` [#file-name]

**Type** `string` · **Required**

File identifier, such as `common.json` or `docs/start.mdx`.

### `fileFormat` [#file-format]

**Type** string union · **Required**

A legacy file-format identifier, such as `'JSON'`, `'PO'`, `'MDX'`, or `'HTML'`.

### `formatMetadata` [#format-metadata]

**Type** `Record<string, any>` · **Optional**

Format-specific metadata.

### `dataFormat` [#data-format]

**Type** [`DataFormat`](/docs/platform/core/reference/types/data-format) · **Optional**

Data format within the file: `'JSX'`, `'ICU'`, or `'I18NEXT'`.

## Legacy example [#legacy-example]

```typescript
// generaltranslation 8.x only
import type { FileToTranslate } from 'generaltranslation';

// JSON file
const jsonFile: FileToTranslate = {
  content: JSON.stringify({
    "welcome": "Welcome",
    "save": "Save"
  }),
  fileName: 'common.json',
  fileFormat: 'JSON',
  dataFormat: 'I18NEXT'
};
```

```typescript
// MDX file
const mdxFile: FileToTranslate = {
  content: `# Getting Started\n\nWelcome to our platform!`,
  fileName: 'docs/start.mdx',
  fileFormat: 'MDX',
  dataFormat: 'JSX'
};
```

## Current replacement [#replacement]

In 9.x, import `FileUpload` from `generaltranslation/types`, upload the source, and use the returned reference for subsequent operations. Unlike `FileToUpload`, which requires `fileId` and `versionId`, `FileUpload` permits server-derived IDs:

```typescript
import { GT } from 'generaltranslation';
import type { FileUpload } from 'generaltranslation/types';

const gt = new GT({
  apiKey: process.env.GT_API_KEY,
  projectId: process.env.GT_PROJECT_ID,
});

const source = {
  content: JSON.stringify({ welcome: 'Welcome' }),
  fileName: 'common.json',
  fileFormat: 'JSON',
  locale: 'en',
} satisfies FileUpload;

const { uploadedFiles } = await gt.uploadSourceFiles(
  [{ source }],
  { sourceLocale: 'en' }
);
```

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
