Types
FileToTranslate
Type definition for file objects used in batch file translation operations
Overview
FileToTranslate represents a file object for batch translation operations with enqueueFiles.
type FileToTranslate = {
content: string;
fileName: string;
fileFormat: FileFormat;
formatMetadata?: Record<string, any>;
dataFormat?: DataFormat;
};Properties
| Property | Type | Required | Description |
|---|---|---|---|
content | string | Yes | Raw file content |
fileName | string | Yes | File identifier |
fileFormat | FileFormat | Yes | File format |
formatMetadata? | Record<string, any> | No | Format-specific metadata |
dataFormat? | DataFormat | No | Data format within file |
Related Types
type FileFormat = 'JSON' | 'MDX' | 'MD' | 'HTML' | 'TXT' | string;
type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';Examples
JSON File
import { FileToTranslate } from 'generaltranslation';
const jsonFile: FileToTranslate = {
content: JSON.stringify({
"welcome": "Welcome",
"save": "Save"
}),
fileName: 'common.json',
fileFormat: 'JSON',
dataFormat: 'I18NEXT'
};MDX File
const mdxFile: FileToTranslate = {
content: `# Getting Started\n\nWelcome to our platform!`,
fileName: 'docs/start.mdx',
fileFormat: 'MDX',
dataFormat: 'JSX'
};Related Types
EnqueueFilesOptions- Batch processing options
How is this guide?