Types
EntryMetadata
Type definition for metadata that customises translation behaviour in Entry objects
Overview
EntryMetadata provides optional configuration for Entry objects in batch translation operations.
type EntryMetadata = {
context?: string;
id?: string;
hash?: string;
dataFormat?: DataFormat;
sourceLocale?: string;
actionType?: ActionType;
timeout?: number;
regionCode?: string;
scriptCode?: string;
};Properties
| Property | Type | Description |
|---|---|---|
context? | string | Context for translators |
id? | string | Unique identifier |
hash? | string | Content hash for caching |
dataFormat? | DataFormat | Format specification |
sourceLocale? | string | Source locale override |
actionType? | ActionType | Preferred translation model |
timeout? | number | Request timeout (ms) |
regionCode? | string | ISO region code |
scriptCode? | string | ISO script code |
Related types
type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';
type ActionType = 'standard' | 'fast' | string;Examples
Basic usage
import { Entry, EntryMetadata } from 'generaltranslation';
const metadata: EntryMetadata = {
context: 'Button label',
actionType: 'quick'
};
const entry: Entry = {
source: 'Save',
targetLocale: 'es',
metadata
};Using the ICU format
const icuEntry: Entry = {
source: '{count, plural, other {{count} items}}',
targetLocale: 'es',
metadata: {
dataFormat: 'ICU',
context: 'Item count'
}
};Related types
Entry- Parent type using this metadataActionType- Translation model options
How is this guide?