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 中

用户可以通过向内容 API 调用传递 locale=all 参数来获取单一类型的所有区域设置。在集合类型上这是不可能的。

🌐 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 中

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

🌐 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.