Types
JsxElement
翻訳対象のJSXコンテンツにおける、HTML風の構造化要素の型定義
概要
JsxElement は、翻訳対象の JSX コンテンツ内にある、HTML に似た構造化要素を表します。
type JsxElement = {
t?: string; // タグ名
i?: number; // id
d?: GTProp; // GTデータ/プロパティ
c?: JsxChildren; // 子要素
};プロパティ
| プロパティ | 型 | 説明 |
|---|---|---|
t? | string | HTML のタグ名 |
i? | number | 内部 ID |
d? | GTProp | GT のプロパティ/属性 |
c? | JsxChildren | 子要素のコンテンツ |
一般的な GT キー
| GT キー | HTML 属性 |
|---|---|
pl | placeholder |
ti | title |
alt | alt |
arl | aria-label |
例
基本的な使用方法
import { JsxElement, Variable } from 'generaltranslation';
// シンプルな要素
const heading: JsxElement = {
t: 'h1',
c: ['ようこそ']
};
// 属性付き
const button: JsxElement = {
t: 'button',
d: { ti: 'フォームを送信' },
c: ['送信']
};関連する型
JsxChildren- children コンテンツの型JsxChild- 個々の子要素
このガイドはどうでしたか?