Skip to main content

locale=all 不能用于获取所有语言环境的所有条目

¥locale=all can not be used to get all entries in all locales

在 Strapi 5 中,不再可能使用 locale=all 参数获取内容类型的所有本地化版本。

¥In Strapi 5, it's no longer possible to get all localized versions of a content type with the locale=all parameter.

此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。

¥This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

 Is this breaking change affecting plugins?Yes
 Is this breaking change automatically handled by a codemod?No

重大更改描述

¥Breaking change description

在 Strapi v4 中

¥In Strapi v4

用户可以通过将 locale=all 参数传递给 Content API 调用来获取单一类型的所有语言环境。这在集合类型上是不可能的。

¥Users could get all of the locales of a single type by passing the locale=all parameter to Content API calls. This is not possible on collection types.

在 Strapi 5 中

¥In Strapi 5

不再可能同时获取所有语言环境中的文档(集合类型或单一类型)。必须传递特定的语言环境值。

¥Getting documents (collection types or single types) in all locales at the same time is not possible anymore. A specific locale value must be passed.

迁移

¥Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

¥This section regroups useful notes and procedures about the introduced breaking change.

注意

¥Notes

有关在 Strapi 5 中可以使用 locale 做什么的更多信息,请参阅 REST APIGraphQL API文档服务 API 参考文档。

¥Additional information on what is possible to do with locale in Strapi 5 is available in the REST API, GraphQL API, and Document Service API reference documentations.

手动程序

¥Manual procedure

使用自定义代码发送带有 locale=all 参数的查询的用户应手动更新其代码以列出所有可用的语言环境,然后逐一请求每个语言环境的数据。

¥Users having custom code sending queries with the locale=all parameter should manually update their code to list all available locales then request data for each of these locales one by one.