Types

EntryMetadata

Type definition for metadata that customizes translation behavior 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

PropertyTypeDescription
context?stringContext for translators
id?stringUnique identifier
hash?stringContent hash for caching
dataFormat?DataFormatFormat specification
sourceLocale?stringSource locale override
actionType?ActionTypeTranslation model preference
timeout?numberRequest timeout (ms)
regionCode?stringISO region code
scriptCode?stringISO script code
type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';
type ActionType = 'standard' | 'fast' | string;

Examples

Basic Usage

import { Entry, EntryMetadata } from 'generaltranslation';

const metadata: EntryMetadata = {
  context: 'Button text',
  actionType: 'fast'
};

const entry: Entry = {
  source: 'Save',
  targetLocale: 'es',
  metadata
};

With ICU Format

const icuEntry: Entry = {
  source: '{count, plural, other {{count} items}}',
  targetLocale: 'es',
  metadata: {
    dataFormat: 'ICU',
    context: 'Item count'
  }
};
  • Entry - Parent type using this metadata
  • ActionType - Translation model options

How is this guide?

EntryMetadata