# General Translation Platform: FileToTranslate (legacy) URL: https://generaltranslation.com/it/docs/platform/core/reference/types/file-to-translate.mdx --- title: FileToTranslate (legacy) description: Consulta l'input file legacy rimosso da Core v9 e il relativo sostituto attuale. Riferimento API per FileToTranslate. --- `FileToTranslate` rappresentava un oggetto file nei workflow di traduzione batch di Core 8.x. Non viene esportato da `generaltranslation` 9.x. **Modificato in v9:** `FileToTranslate` è stato rimosso. Usa `FileToUpload` per [`uploadSourceFiles`](/docs/platform/core/reference/gt-class-methods/translation/upload-source-files), quindi passa i riferimenti ai file restituiti a [`enqueueFiles`](/docs/platform/core/reference/gt-class-methods/translation/enqueue-files). ## Panoramica [#overview] Il tipo legacy raggruppava il contenuto grezzo, il nome e il formato di un file: ```typescript type FileToTranslate = { content: string; fileName: string; fileFormat: FileFormat; formatMetadata?: Record; dataFormat?: DataFormat; }; ``` ## Proprietà [#properties] | Proprietà | Descrizione | Tipo | Facoltativo | | ------------------------------------ | ------------------------------------------- | --------------------------------------------------------------- | ----------- | | [`content`](#content) | contenuto grezzo del file. | `string` | No | | [`fileName`](#file-name) | Identificatore del file. | `string` | No | | [`fileFormat`](#file-format) | Identificatore legacy del formato del file. | unione di stringhe | No | | [`formatMetadata`](#format-metadata) | Metadati specifici del formato. | `Record` | Sì | | [`dataFormat`](#data-format) | Formato dei dati all'interno del file. | [`DataFormat`](/docs/platform/core/reference/types/data-format) | Sì | ### `content` [#content] **Tipo** `stringa` · **Obbligatorio** Contenuto grezzo del file. ### `fileName` [#file-name] **Tipo** `stringa` · **Obbligatorio** Identificatore del file, ad esempio `common.json` o `docs/start.mdx`. ### `fileFormat` [#file-format] **Tipo** unione di stringhe · **Obbligatorio** Un identificatore legacy del formato di file, ad esempio `'JSON'`, `'PO'`, `'MDX'` o `'HTML'`. ### `formatMetadata` [#format-metadata] **Tipo** `Record` · **Facoltativo** Metadati specifici del formato. ### `dataFormat` [#data-format] **Tipo** [`DataFormat`](/docs/platform/core/reference/types/data-format) · **Facoltativo** Formato dei dati nel file: `'JSX'`, `'ICU'` o `'I18NEXT'`. ## Esempio legacy [#legacy-example] ```typescript // solo generaltranslation 8.x import type { FileToTranslate } from 'generaltranslation'; // File JSON const jsonFile: FileToTranslate = { content: JSON.stringify({ "welcome": "Welcome", "save": "Save" }), fileName: 'common.json', fileFormat: 'JSON', dataFormat: 'I18NEXT' }; ``` ```typescript // File MDX const mdxFile: FileToTranslate = { content: `# Getting Started\n\nWelcome to our platform!`, fileName: 'docs/start.mdx', fileFormat: 'MDX', dataFormat: 'JSX' }; ``` ## Sostituzione attuale [#replacement] Nella versione 9.x, importa `FileToUpload` da `generaltranslation/types`, carica il file sorgente e usa il riferimento restituito nelle operazioni successive: ```typescript import { GT } from 'generaltranslation'; import type { FileToUpload } 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 FileToUpload; const { uploadedFiles } = await gt.uploadSourceFiles( [{ source }], { sourceLocale: 'en' } ); ```