Skip to content

Unable to get an item from a collection for a specific locale #15945

@1saifj

Description

@1saifj

Bug report

Required System information

Node.js version: 16.19.1
Yarn version: 1.22.19
Strapi version: 4.7.0
Database: Sqlite
Operating system: Windows 11
Javascript

Describe the bug

I have a collection faq-groups that enabled localization for it, it is working fine when I trying to fetch the locale for the collection, by:

http://localhost:1337/api/faq-groups?locale=ar

{
      "data": [
            {
                  "id": 2,
                  "attributes": {
                        "Name": "عام",
                        "Description": "fssf",
                        "createdAt": "2023-02-22T13:28:46.344Z",
                        "updatedAt": "2023-02-27T07:37:21.103Z",
                        "publishedAt": "2023-02-22T13:33:38.389Z",
                        "locale": "ar"
                  }
            }
      ],
      "meta": {
            "pagination": {
                  "page": 1,
                  "pageSize": 25,
                  "pageCount": 1,
                  "total": 1
            }
      }
}

but it failed to retrieve the locale for a specific item from this collection, by:

http://localhost:1337/api/faq-groups/1?locale=ar

and this returned only English locale:

{
      "data": {
            "id": 1,
            "attributes": {
                  "Name": "general",
                  "Description": "srfd",
                  "createdAt": "2023-02-22T13:28:40.645Z",
                  "updatedAt": "2023-02-27T08:31:54.555Z",
                  "publishedAt": "2023-02-22T13:33:25.442Z",
                  "locale": "en"
            }
      },
      "meta": {}
}

Steps to reproduce the behavior

Create a collection of your choice, enable the Internationalization for it, and fetch one item after adding data with its localization.

Expected behavior

Getting the data in a requested locale for an item from a collection.

Screenshots

image

Metadata

Metadata

Assignees

Labels

issue: bugIssue reporting a bugstatus: confirmedConfirmed by a Strapi Team member or multiple community membersstatus: will not fixWon't fix as it's either intended or for some other reason

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions