System Information
- Strapi Version: 4.4.5
- Operating System: Linux
- Database: Postgres
- Node Version: v18.8.0
- NPM Version: v8.19.1
- Yarn Version: v1.22.19
I have the endpoint /api/products?populate=deep,4&locale=en
, when sending a GET request I get the following output:
{
"data": [
{
"id": 4,
"attributes": {
"price": 789,
"weight": 2.34,
"createdAt": "2022-11-19T21:12:58.157Z",
"updatedAt": "2022-12-30T21:04:13.807Z",
"publishedAt": "2022-11-19T21:12:58.154Z",
"in_stock": 1,
"new_item": false,
"visible": true,
"recommended_price": 0,
"featured": true,
"categories": {
"data": [
{
"id": 2,
"attributes": {
"name": "CategoryA",
"description": "Some mock categoryA",
"createdAt": "2022-11-06T15:21:11.276Z",
"updatedAt": "2022-12-31T16:22:17.497Z",
"publishedAt": "2022-11-06T17:17:03.753Z",
"locale": "en",
"slug": "cata",
}
}
]
}
}
I integrated localization to the API to get localized content for each data returned, now I have a problem that each category with different localization has its own different ID, so even if sending GET request to endpoint /api/products?populate=deep,4&locale=ar
I would still get relations as it is. Is there any solution for this or a workaround?
As a temporary solution I am creating boilerplate code each time creating a content-type I have to create a mapping function that maps locale from localizations
field of content-type. It would be cool if there is a possible way to get data based on locale provided.