Types
EntryMetadata
Entry オブジェクトの翻訳動作をカスタマイズするメタデータの型定義
概要
EntryMetadata は、バッチ翻訳時の Entry オブジェクト向けに任意の設定を提供します。
type EntryMetadata = {
context?: string;
id?: string;
hash?: string;
dataFormat?: DataFormat;
sourceLocale?: string;
actionType?: ActionType;
timeout?: number;
regionCode?: string;
scriptCode?: string;
};プロパティ
| プロパティ | 型 | 説明 |
|---|---|---|
context? | string | 翻訳者向けのコンテキスト |
id? | string | 一意の識別子 |
hash? | string | キャッシュ用のコンテンツハッシュ |
dataFormat? | DataFormat | 形式仕様 |
sourceLocale? | string | sourceLocale のオーバーライド |
actionType? | ActionType | 翻訳モデルの優先度設定 |
timeout? | number | リクエストのタイムアウト(ms) |
regionCode? | string | ISO 地域コード |
scriptCode? | string | ISO スクリプトコード |
関連型
type DataFormat = 'JSX' | 'ICU' | 'I18NEXT';
type ActionType = 'standard' | 'fast' | string;例
基本的な使用方法
import { Entry, EntryMetadata } from 'generaltranslation';
const metadata: EntryMetadata = {
context: 'ボタンのテキスト',
actionType: 'fast'
};
const entry: Entry = {
source: '保存',
targetLocale: 'es',
metadata
};ICU フォーマット対応
const icuEntry: Entry = {
source: '{count, plural, other {{count}件}}',
targetLocale: 'es',
metadata: {
dataFormat: 'ICU',
context: '件数'
}
};関連する型
Entry- このメタデータを使用する親型ActionType- 翻訳モデルのoptions
このガイドはいかがですか?