跳到主要内容
版本:Canary 🚧

no-untranslated-text

确保 JSX 中的所有文本标签都被翻译 API 包裹。

When the i18n feature is used, this rule ensures that all labels appearing on the website are translatable, so no string accidentally slips through untranslated.

规则详情

此规则的错误代码示例:

// Hello World 未被翻译
<Component>Hello World</Component>

此规则的正确代码示例:

// Hello World 能被翻译
<Component>
<Translate>Hello World</Translate>
</Component>

规则配置

接受的字段:

选项类型默认值描述
ignoredStringsstring[][]如果文本标签完全由此列表包含的字符串组成,将不会被报告。

何时不使用它

If you're not using the i18n feature, you can disable this rule. 你也可以在不应被翻译的文本处禁用这条规则。

延伸阅读