Content Internationalization (i18n) beta is live 馃實

Are you talking about this? Unable to disable localization for relationship fields. 路 Issue #10322 路 strapi/strapi 路 GitHub

Hello @justus
Thanks for the feedback :+1: It鈥檚 made on purpose.
We took that decision to stay coherent with the current behavior on RBAC when you add a new field or CT: by default the permissions are not checked. So that motivated us to apply the same behavior for i18n.
I agree that it鈥檚 might not be the fastest way to get roles ready, but we consider that it is safer to hide newly created content (CT, field, I18n activation) by default and then to allow access to it, than the other way around :slight_smile:

Hello @wlixw87

Here is some info you probably wait for :slight_smile:
(cc @glo and @LuisAlaguna)

We don鈥檛 take the relations when using the 鈥渇ill in from鈥 feature because of a technical limitation. In some cases, depending on the relationship type between 2 entities, and depending on the activation of i18n on only one or both Collection-types (CT), recreating the same relation in several locales could break it.
e.g. In the case where i18n is activated on a CT but not on the other one, and where the relationship type is one-to-one, then if we just recreate the same relation in a new locale we break it on the other side of the relation (the other CT) without knowing it.

We thought about limiting the use of some relationship types in the CTB (content type builder) directly to avoid ending up in this kind of situation. But i18n being a plugin we were too limited and it would have been too complex to implement.

To avoid having the same issue when adding a relation manually from the Edit View, we now apply a filter on the relations you can add, depending on whether i18n is activated on one or both CTs you鈥檒l only be able to create a relation to an entity with the same locale.

That鈥檚 also why localization is forced on Relational fields.

The good news is that the new db model in the v4 will solve this technical limitation :slight_smile:
I18n helped us identify several limitations in our model and the v4 is here to make Strapi more robust and offer more flexibility.

Feel free if you have any questions.


By the way, talking about relations, we are currently doing some researches on this topic and it would be awesome if you could share some info about your Strapi projects, your use cases, and needs regarding relations in this forum post. It鈥檚 gonna help us make the most of the new model in the v4 :wink:

Hi guys,

I鈥檓 quite new at the Strapi and I have a problem how fetch localized data using GraphQL. Here I found the information how to query data using REST API, but I cannot find what I鈥檓 doing wrong using GraphQL.

This is a JSON structure of response for the default lang (de-CH):

{
鈥渋d鈥: 5,
鈥渓ocale鈥: 鈥渄e-CH鈥,
鈥減ublished_at鈥: 鈥2021-05-11T12:04:23.616Z鈥,
鈥渃reated_at鈥: 鈥2021-05-11T11:56:10.146Z鈥,
鈥渦pdated_at鈥: 鈥2021-05-11T16:44:59.947Z鈥,
鈥渕ainTitle鈥: null,
鈥渃ontent鈥: null,
鈥渙penDialogButtonLabel鈥: "Ich abonniere! ",
鈥渟eo鈥: {
鈥渋d鈥: 40,
鈥渕etaTitle鈥: 鈥淜ommt bald鈥,
鈥渕etaDescription鈥: 鈥淜ommt bald desc鈥,
鈥渕etaKeywords鈥: 鈥溾,
鈥減reventIndexing鈥: false,
鈥渃annonicalLink鈥: null,
鈥渟haredImage鈥: null
},
鈥渄ialog鈥: {
鈥渋d鈥: 5,
鈥淭itle鈥: null,
鈥淥fferSummary鈥: null,
鈥淐onfiramtionReminder鈥: null,
鈥淩epeatConfirmationReminder鈥: null,
鈥淐lause鈥: null,
鈥渢itle鈥: null,
鈥渃onfiramtionReminder鈥: null,
鈥渞epeatConfirmationReminder鈥: null,
鈥渃lause鈥: null,
鈥渙fferSummary鈥: null,
鈥渇orm鈥: null
},
鈥渓ogo鈥: null,
鈥渓ocalizations鈥: [
{
鈥渋d鈥: 3,
鈥渓ocale鈥: 鈥減l-PL鈥,
鈥減ublished_at鈥: 鈥2021-05-12T17:14:19.643Z鈥
},
{
鈥渋d鈥: 6,
鈥渓ocale鈥: 鈥渆n-GB鈥,
鈥減ublished_at鈥: 鈥2021-05-12T17:16:01.446Z鈥
}
]
}

When I test the query without any filters like this:

query MyQuery {
strapiComingSoon {
openDialogButtonLabel
locale
}
}

I get the correct response:

{
鈥渄ata鈥: {
鈥渟trapiComingSoon鈥: {
鈥渙penDialogButtonLabel鈥: "Ich abonniere! ",
鈥渓ocale鈥: 鈥渄e-CH鈥
}
},
鈥渆xtensions鈥: {
鈥渆nableRefresh鈥: 鈥1鈥
}
}

This is a JSON structure of response for PL version (url/page?_locale=pl=PL)

{
鈥渋d鈥: 3,
鈥渓ocale鈥: 鈥減l-PL鈥,
鈥減ublished_at鈥: 鈥2021-05-12T17:14:19.643Z鈥,
鈥渃reated_at鈥: 鈥2021-05-07T12:55:24.182Z鈥,
鈥渦pdated_at鈥: 鈥2021-05-12T17:14:19.859Z鈥,
鈥渕ainTitle鈥: 鈥淪trona w budowie鈥,
鈥渃ontent鈥: null,
鈥渙penDialogButtonLabel鈥: 鈥淶apisuj臋 si臋!鈥,
鈥渟eo鈥: {
鈥渋d鈥: 41,
鈥渕etaTitle鈥: 鈥淪trona w budowie鈥,
鈥渕etaDescription鈥: 鈥淥pis strony w budowie鈥,
鈥渕etaKeywords鈥: null,
鈥減reventIndexing鈥: false,
鈥渃annonicalLink鈥: null,
鈥渟haredImage鈥: null
},
鈥渄ialog鈥: {
鈥渋d鈥: 6,
鈥淭itle鈥: null,
鈥淥fferSummary鈥: null,
鈥淐onfiramtionReminder鈥: null,
鈥淩epeatConfirmationReminder鈥: null,
鈥淐lause鈥: null,
鈥渢itle鈥: null,
鈥渃onfiramtionReminder鈥: null,
鈥渞epeatConfirmationReminder鈥: null,
鈥渃lause鈥: null,
鈥渙fferSummary鈥: null,
鈥渇orm鈥: null
},
鈥渓ogo鈥: null,
鈥渓ocalizations鈥: [
{
鈥渋d鈥: 5,
鈥渓ocale鈥: 鈥渄e-CH鈥,
鈥減ublished_at鈥: 鈥2021-05-11T12:04:23.616Z鈥
},
{
鈥渋d鈥: 6,
鈥渓ocale鈥: 鈥渆n-GB鈥,
鈥減ublished_at鈥: 鈥2021-05-12T17:16:01.446Z鈥
}
]
}

And when I trying query using GraphQL like this (with filter):

query MyQuery {
strapiComingSoon(locale: {eq: 鈥減l-PL鈥潁) {
openDialogButtonLabel
locale
}
}

In response I get:

{
鈥渄ata鈥: {
鈥渟trapiComingSoon鈥: null
},
鈥渆xtensions鈥: {
鈥渆nableRefresh鈥: 鈥1鈥
}
}

What should I do to fetch Polish version of the Single Type? Thanks in advance for every help

Is it also working for images or text only?

Right now it works for every field by default: it creates a new object, somehow they are linked, but the localization object, let鈥檚 say a page, it a new page; hence, you can fulfill it as you want: same image but with different languange, or same video but in another language, different relations, etc. The last one is annoying because, in our case, we don鈥檛 want to localize the relationship fields, and right now it is imposible to unlocalize them.

1 Like

Thank you Luis, and before internationalization i18n, how did you implemented multilanguage and images? (Maybe you did, just an assumption)

I never had the need to localize images, but for localizing text I used to create a field with the same name but localization short label suffixed.