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 | ソース locale の上書き | 
| actionType? | ActionType | 翻訳モデルの優先設定 | 
| timeout? | number | リクエストのタイムアウト(ミリ秒) | 
| 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} items}}',
  targetLocale: 'es',
  metadata: {
    dataFormat: 'ICU',
    context: 'アイテム数'
  }
};関連する型
- Entry- このメタデータを利用する親タイプ
- ActionType- 翻訳モデルのoptions
このガイドはどうでしたか?

