API not showing localization data

I came back to an old V3 project intending to add localization. Everything seems to work just fine except, i am not getting the localized data in a REST response.
/ID?locale=en is just showing the default ‘nl’ content.

locale=all is not working either

The response:

{"id":3,"title":"dqfewefeqf","locale":"nl", ... ...},"localizations":[{"id":2,"locale":"en", || WHERE IS ALL THE DATA?? || }]}

I have tried disabling the draft system, to no avail.
If however i switch the default locale from ‘nl’ to ‘en’, it will show me the ‘en’ localized content, but then it wont show the ‘nl’ one. Its driving me up the wall…

I have also noticed that this seems to be a bug still present in v4? So please dont call me out on using v3 for this still, as it seems to make no difference.

This topic has been created from a Discord post (1249836521713041418) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

is the related locale entry published?

working fine for me on the latest version:

detailed view with the populate *

❯ yarn strapi report --all
yarn run v1.22.22
$ strapi report --all
Launched In: 242 ms
Environment: development
OS: linux-x64
Strapi Version: 4.24.5
Node/Yarn Version: yarn/1.22.22 npm/? node/v20.11.1 linux x64
Edition: Community
Database: sqlite
UUID: 6d780c96-721e-4d14-b698-560211ee1250
Dependencies: {
  "@strapi/strapi": "4.24.5",
  "@strapi/plugin-users-permissions": "4.24.5",
  "@strapi/plugin-i18n": "4.24.5",
  "@strapi/plugin-cloud": "4.24.5",
  "better-sqlite3": "8.6.0",
  "react": "^18.0.0",
  "react-dom": "^18.0.0",
  "react-router-dom": "5.3.4",
  "styled-components": "5.3.3"
}
Dev Dependencies: {}
Done in 1.59s.

Ok, thats good. If everything fails, i might need to get back at attempting to migrate to 4.
Its so weird tho…

By the way, are these collection-types? As i find the issue in single-type

yeah collection-type

let me test with single type

Roger dodger

TBH though with regards to Strapi 3 vs Strapi 4

you might honestly be better off starting a new project on 4

Ye thats what i found as wel. The migration tool left me with all sorts off errors.

Those scripts were built by a partner of ours but we don’t really fix or maintain them anymore as v3 has been dead for a long time now

ST no locale with populate:

// 20240610162416
// http://localhost:1337/api/testst?populate=*

{
  "data": {
    "id": 1,
    "attributes": {
      "test": "test en",
      "createdAt": "2024-06-10T23:23:38.726Z",
      "updatedAt": "2024-06-10T23:23:43.955Z",
      "publishedAt": "2024-06-10T23:23:39.577Z",
      "locale": "en",
      "localizations": {
        "data": [
          {
            "id": 2,
            "attributes": {
              "test": "test fr",
              "createdAt": "2024-06-10T23:23:43.901Z",
              "updatedAt": "2024-06-10T23:23:44.791Z",
              "publishedAt": "2024-06-10T23:23:44.789Z",
              "locale": "fr"
            }
          }
        ]
      }
    }
  },
  "meta": {
    
  }
}

with locale:

// 20240610162527
// http://localhost:1337/api/testst?locale=fr&populate=*

{
  "data": {
    "id": 2,
    "attributes": {
      "test": "test fr",
      "createdAt": "2024-06-10T23:23:43.901Z",
      "updatedAt": "2024-06-10T23:23:44.791Z",
      "publishedAt": "2024-06-10T23:23:44.789Z",
      "locale": "fr",
      "localizations": {
        "data": [
          {
            "id": 1,
            "attributes": {
              "test": "test en",
              "createdAt": "2024-06-10T23:23:38.726Z",
              "updatedAt": "2024-06-10T23:23:43.955Z",
              "publishedAt": "2024-06-10T23:23:39.577Z",
              "locale": "en"
            }
          }
        ]
      }
    }
  },
  "meta": {
    
  }
}

seems to work fine there too, what version are you on?

Awesome, thanks. Reckon i’ll just start migrating tomorrow.

On that note, is the db data structure different as well right? So im looking at recreating the models and repopulating in a new db?

Yeah pretty much, a lot of the data structure is the same but many of the table names have changed

also every relationship now has a middle joining table

Aah ye was afraid that was the case. No worries, it is what it is then!

Thanks for your quick replies, much appreciated!