Types
EntryMetadata
Typdefinition für Metadaten, die das Übersetzungsverhalten in Entry-Objekten steuern
Übersicht
EntryMetadata stellt optionale Konfiguration für Entry-Objekte bei Batch-Übersetzungen bereit.
type EntryMetadata = {
context?: string;
id?: string;
hash?: string;
dataFormat?: DataFormat;
sourceLocale?: string;
actionType?: ActionType;
timeout?: number;
regionCode?: string;
scriptCode?: string;
};Eigenschaften
| Eigenschaft | Typ | Beschreibung |
|---|---|---|
context? | string | Kontext für Übersetzende |
id? | string | Eindeutige Kennung |
hash? | string | Inhalts-Hash für Caching |
dataFormat? | DataFormat | Formatspezifikation |
sourceLocale? | string | Quell-Locale-Override |
actionType? | ActionType | Bevorzugtes Übersetzungsmodell |
timeout? | number | Anfrage-Zeitüberschreitung (ms) |
regionCode? | string | ISO-Regionscode |
scriptCode? | string | ISO-Schriftcode |
Zugehörige Typen
type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';
type ActionType = 'standard' | 'fast' | string;Beispiele
Grundlegende Nutzung
import { Entry, EntryMetadata } from 'generaltranslation';
const metadata: EntryMetadata = {
context: 'Button-Text',
actionType: 'schnell'
};
const entry: Entry = {
source: 'Speichern',
targetLocale: 'es',
metadata
};Mit dem ICU-Format
const icuEntry: Entry = {
source: '{count, plural, other {{count} Elemente}}',
targetLocale: 'es',
metadata: {
dataFormat: 'ICU',
context: 'Anzahl der Elemente'
}
};Verwandte Typen
Entry- Übergeordneter Typ, der diese Metadaten verwendetActionType- options des Übersetzungsmodells
Wie ist diese Anleitung?