# General Translation Platform: Content
URL: https://generaltranslation.com/zh/docs/platform/core/reference/types/content.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 支持翻译的内容格式。Content 类型的 API 参考。

`Content` 是 General Translation 可翻译的所有内容格式组成的联合类型。它会作为 [`TranslateManyEntry`](/docs/platform/core/reference/types/translate-many-entry) 的 `source` 字段出现，也会作为 [`translate`](/docs/platform/core/reference/gt-class-methods/translation/translate) 和 [`translateMany`](/docs/platform/core/reference/gt-class-methods/translation/translate-many) 的输入。

## 概览 [#overview]

`Content` 将结构化的 JSX 内容与基于 string 的消息格式统一到同一种类型中。该类型可根据值的结构推断，也可以在 entry 的元数据中通过 [`DataFormat`](/docs/platform/core/reference/types/data-format) 显式指定。

```typescript
type Content = JsxChildren | IcuMessage | StringMessage | I18nextMessage;
```

*注意：* string 成员 (`IcuMessage`、`StringMessage`、`I18nextMessage`) 都是 `string` 的别名；在原始定义中，它们被归为 `StringContent`，因此 `Content` 也等同于 `JsxChildren | StringContent`。

## 成员 [#members]

| 成员                                   | 描述                     | 类型                            |
| ------------------------------------ | ---------------------- | ----------------------------- |
| [`JsxChildren`](#jsx-children)       | 带有元素和变量的富 JSX 内容。      | `object` | `array` | `string` |
| [`IcuMessage`](#icu-message)         | ICU MessageFormat 字符串。 | `string`                      |
| [`I18nextMessage`](#i18next-message) | 与 i18next 兼容的消息字符串。    | `string`                      |
| [`StringMessage`](#string-message)   | 纯字符串内容。                | `string`                      |

### `JsxChildren` [#jsx-children]

**类型** [`JsxChildren`](/docs/platform/core/reference/types/jsx-children)

由文本、结构化元素和变量构成的富 JSX 内容。适用于 React 组件和结构化 HTML 内容。 (完整结构请参阅 [`JsxChildren`](/docs/platform/core/reference/types/jsx-children)) 。

```typescript
const jsxContent: Content = {
  t: 'div',
  c: ['Hello ', { k: 'userName' }]
};
```

### `IcuMessage` [#icu-message]

**类型** `string`

一种 ICU MessageFormat 字符串。可用于处理复杂的复数处理以及日期/数字格式。

```typescript
const icuContent: Content = 'Hello {name}!' as IcuMessage;
```

### `I18nextMessage` [#i18next-message]

**类型** `string`

与 i18next 兼容的消息字符串。适用于简单的插值场景以及现有的 i18next 项目。

```typescript
const i18nextContent: Content = 'Welcome back, {{name}}!' as I18nextMessage;
```

### `StringMessage` [#string-message]

**类型** `string`

纯字符串内容，不包含插值、复数处理或格式化。用于简单文本。

```typescript
const stringContent: Content = 'Hello, world!' as StringMessage;
```

## 备注 [#notes]

* `Content` 将不同的消息格式统一到了同一种类型中。
* 内容类型可以根据结构推断，也可以通过 [`EntryMetadata`](/docs/platform/core/reference/types/entry-metadata) 中的 [`DataFormat`](/docs/platform/core/reference/types/data-format) 显式指定。

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
