国际化(i18n)
¥Internationalization (i18n)
Page summary:
Internationalization manages content in multiple locales directly from the admin panel. This documentation explains how to add locales, translate entries, and control locale-specific permissions.
国际化功能允许管理不 同语言的内容,称为 "locales"。
¥The Internationalization feature allows to manage content in different languages, called "locales".
配置
¥Configuration
在内容管理器中可用之前,必须从 设置中配置国际化功能,并且应从 内容类型构建器在你的内容类型上启用它。
¥Before being usable in the Content Manager, the Internationalization feature must be configured from Settings, and it should be enabled on your content types from the Content-type Builder.
内容类型生成器
¥Content-type Builder
配置功能的路径: 内容类型生成器
¥Path to configure the feature: Content-type Builder
为了使你的内容类型能够在内容管理器中使用国际化进行翻译,必须通过内容类型构建器启用该功能。可以为每种内容类型和/或字段配置国际化。
¥For your content types to be translatable with Internationalization in the Content Manager, the feature must be enabled through the Content-type Builder. Internationalization can be configured for each content type and/or field.
-
编辑所选已创建的内容类型/字段,或创建新的内容类型/字段。
¥Either edit the already created content type/field of your choice, or create a new content type/field.
-
转到高级设置选项卡。
¥Go to the Advanced settings tab.
-
在内容类型级别勾选名为 "国际化" 的选项,在字段级别勾选名为 "启用该字段的本地化" 的选项。
¥Tick the option named "Internationalization" at content-type level, and "Enable localization for this field" at field level.

设置
¥Settings
配置功能的路径: 设置 > 全局设置 > 国际化
¥Path to configure the feature: Settings > Global Settings > Internationalization
国际化界面显示一个表格,列出了 Strapi 应用可用的所有语言环境。默认情况下,仅配置英语区域设置并将其设置为默认区域设置。
¥The Internationalization interface displays a table listing all locales available for the Strapi application. By default, only the English locale is configured and set as the default locale.
对于每个区域设置,该表显示该区域设置的默认 ISO 代码、其 可选显示名称,并指示该区域设置是否设置为默认区域设置。从该表中,管理员还可以:
¥For each locale, the table displays the default ISO code of the locale, its optional display name and indicates if the locale is set as the default one. From the table, administrators can also:
-
点击编辑按钮 编辑语言环境
¥Click on the edit button to edit a locale
-
单击删除按钮 删除语言环境
¥Click on the delete button to delete a locale
添加新区域设置
¥Adding a new locale
管理员可以根据需要添加和管理任意数量的区域设置。然而,只能将一种区域设置设置为整个 Strapi 应用的默认区域设置。
¥Administrators can add and manage as many locales as they want. There can however only be one locale set as the default one for the whole Strapi application.
无法创建自定义区域设置。只能根据 Strapi 设置的 500 多个预先创建的语言环境列表 创建语言环境。
¥It is not possible to create custom locales. Locales can only be created based on the 500+ pre-created list of locales set by Strapi.
-
单击添加新区域设置按钮。
¥Click on the Add new locale button.
-
在区域设置添加窗口中,从区域设置下拉列表中选择新的区域设置。后者按字母顺序列出了所有可以添加到你的 Strapi 应用中的区域设置,并显示为其 ISO 代码。
¥In the locale addition window, choose your new locale among the Locales drop-down list. The latter lists alphabetically all locales, displayed as their ISO code, that can be added to your Strapi application.
-
(可选)在区域设置显示名称文本框中,为新区域设置写入新的显示名称。
¥(optional) In the Locale display name textbox, write a new display name for your new locale.
-
(可选)在“高级设置”选项卡中,勾选“设为默认区域设置”设置,使你的新区域设置成为 Strapi 应用的默认区域设置。
¥(optional) In the Advanced settings tab, tick the Set as default locale setting to make your new locale the default one for your Strapi application.
-
单击“保存”按钮确认添加新区域设置。
¥Click on the Save button to confirm the addition of your new locale.

启用 AI 驱动的国际化
¥Enabling AI-powered internationalization
GrowthThis feature is available with a Growth plan.当默认语言环境的内容更新时,AI 驱动的国际化功能会自动为项目中的所有语言环境进行翻译。这使内容编辑人员能够在几秒钟内将其内容翻译成多种语言。
¥AI-Powered Internationalization enables automatic translations for all the locales in a project when the content in the default locale is updated. This enables content editors to have their content translated into multiple languages within a few seconds.
AI 驱动的国际化功能默认处于禁用状态。要启用它,请转到“设置”>“全局设置”>“国际化”,并将“AI 翻译”设置为“已启用”。
¥AI-powered Internationalization is disabled by default. To enable it, go to Settings > Global Settings > Internationalization and set AI Translations to Enabled.

基于代码的配置
¥Code-based configuration
可以配置 STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE 环境变量 来设置你的环境的默认区域设置。此变量使用的值应为来自 500 多个预先创建的语言环境列表 的 ISO 国家代码。
¥A STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE environment variable can be configured to set the default locale for your environment. The value used for this variable should be an ISO country code from the 500+ pre-created list of locales.
用法
¥Usage
使用功能的路径: 内容管理器,内容类型的编辑视图
¥Path to use the feature: Content Manager, edit view of your content type
在 内容管理者 中,当为内容类型启用国际化功能时,编辑 视图的右上角会添加一个语言环境下拉列表,并允许切换语言环境。
¥In the Content Manager, when the Internationalization feature is enabled for the content-type, a locale drop-down list is added to the top right of the edit view and allows to switch locales.
国际化功能还允许动态区域和组件在不同语言环境中有所不同。根据区域设置,动态区域确实可以根据区域设置具有不同的结构,并且可重复组件可以具有不同的条目并且也可以以不同的方式组织。
¥The Internationalization feature also allows dynamic zones and components to differ from one locale to another. Depending on the locale, dynamic zones can indeed have different structures depending on the locale, and repeatable components can have different entries and be organized differently as well.
内容一次只能在一种区域设置下进行管理。无法同时编辑或发布多个区域设置的内容(例如,单击“发布”按钮将仅发布你当前正在处理的区域设置的内容)。
¥Content can only be managed one locale at the time. It is not possible to edit or publish content for several locales at the same time (e.g. Clicking on the Publish button will only publish the content for the locale you are currently working on).
要翻译其他语言环境中的内容:
¥To translate content in another locale:
-
在编辑视图的右上角,单击语言环境下拉列表。
¥On the top right of the edit view, click on the locale drop-down list.
-
选择你想要翻译内容的区域设置。
¥Choose the locale in which you want to translate your content.
-
通过填写内容类 型的字段来翻译你的内容。
¥Translate your content by filling up your content-type's fields.

单击右上角的 从另一个语言环境填写按钮,所有非关系字段都将用另一个所选语言环境的值填充。如果你不记得另一个语言环境中的确切内容是什么,它可能会很有用。如果你已启用 AI 驱动的国际化,则此按钮不可见,因为翻译由 Strapi AI 自动处理。
¥Click on the Fill in from another locale button, in the top right corner, for all non relational fields to be filled up with the values of another chosen locale. It can be useful if you do not remember what was the exact content in another locale. This button is not visible if you've enabled AI-powered internationalization since translations are automatically handled by Strapi AI.
AI 驱动的国际化 NewThis content is new.
¥AI-powered internationalization NewThis content is new.
GrowthThis feature is available with a Growth plan.启用后,AI 驱动的国际化功能,可在源内容更新时自动为项目中的所有语言环境进行翻译。这使内容编辑人员能够在几秒钟内将其内容翻译成多种语言。此功能旨在确保用户仅手动填写默认语言环境的内容,Strapi AI 会自动将其翻译成所有其他现有语言环境。
¥When enabled, AI-powered internationalization enables automatic translations for all the locales in a project when the source content is updated. This enables content editors to have their content translated into multiple languages within a few seconds. The idea behind the feature is to ensure users only manually fill in content in the default locale, and Strapi AI translates it for all other existing locales.
启用后,每当你在默认语言环境中编辑内容类型并单击“保存”时,该内容类型的所有其他语言环境都应自动翻译,并且会收到“所有语言环境均已翻译”的通知。使用此功能会消耗 Strapi AI 积分。
¥Once enabled, whenever you edit a content-type in the default locale and click Save, all other locales for the content-type should be translated automatically, which will be confirmed by an All locales have been translated notification. Using this feature consumes Strapi AI credits.

AI 驱动的国际化功能是单向的,默认语言环境的内容是唯一的权威来源。因此,启用此功能后:
¥AI-powered internationalization only works one way, keeping the default locale content as the unique source of truth. Consequently, once the feature is enabled:
-
编辑和保存除默认语言之外的任何语言的内容都不会触发自动翻译。
¥Editing and saving content for any locale othen than the default one will not trigger automatic translations.
-
编辑默认语言环境的内容时,对其他语言环境所做的手动修改将被覆盖。
¥When editing the content for the default locale, the manual modifications made to other locales will be overwritten.
Strapi AI 在 Growth 计划中每月包含 1,000 个积分,免费试用期间包含 10 个免费积分。轻量级操作使用的积分较少,而更复杂的操作则使用更多积分。
¥Strapi AI includes 1,000 credits per month on the Growth plan, and 10 free credits during the free trial. Lightweight actions use fewer credits, while more complex ones use more.
你可以在管理面板的 设置概览 中查看你的信用使用情况。当你的使用量达到每月限额的 80%、90% 和 100% 时,系统会发送通知。
¥You can check your credit usage in the Settings Overview of the admin panel. Notifications are sent when your usage reaches 80%, 90%, and 100% of your monthly allowance.
当你的 Growth 套餐积分用完后,你可以继续使用 Strapi AI,超出部分将按月计费。
¥When your credits run out on the Growth plan, you can keep using Strapi AI, with overages billed monthly.
有关 Strapi AI 的更多信息,请参阅 专门的支持文章。
¥For more information about Strapi AI, please refer to the dedicated support article.
使用 API
¥Usage with APIs
可以通过 Strapi 的内容 API 访问的各种前端 API 为给定语言环境请求、创建、更新和删除本地化内容:
¥Localized content can be requested, created, updated, and deleted for a given locale through the various front-end APIs accessible from Strapi's Content API:
REST API
Learn how to use the locale parameter with the REST API.
GraphQL API
Learn how to use the locale parameter with GraphQL API.
在 Strapi 的后端服务器上,文档服务 API 还可用于与本地化内容进行交互:
¥On the back-end server of Strapi, the Document Service API can also be used to interact with localized content: