You need to activate i18n on your content type.
To do so, you need to go in the content type builder, click on the pencil icon next to the content type’s name, go to the advanced settings and check the “Enable localization for the content type” checkbox.
Then you can control the localisation of each field in the advanced tab of each attribute.
Here are some informations about the localisation:
when i18n is enable on a content type all relational fields are localised
the uid field will always be localised due to the unique constraint
dynamique zones and components can be localised
Unique fields must also be localised because of the unique constraint
It’s a hard requirement of how we store the information in the database while still keeping database constraints. Setting something as unique applies a database constraint and since all locales are stored in the same database table you can’t have two entries (say english and french) that share the same unique value.
Abstracting them out to different tables in the database means all relations become polymorphic in nature making relations extremely complicated to manage.
As I do understand the requirement explained above, this is still a bummer.
It means there is no way to identify an entity with the same but unique textual attribute ?
Like a guid or sku attribute assigned to a product for example ?
Thanks for building Strapi <3 and adding the long-awaited localization feature.
This doesn’t make a lot of sense to me. Uniques should be the same across all locales, technically (coming from RDBMS background) this can be implemented as a unique constraint on two columns.
For those looking for a hack, I’m providing this sample from one of my products. On PostgreSQL I did the following to fix this on the database level:
alter table products
drop constraint "products_SKU_unique"; // this query deletes the constraint created automatically by strapi
alter table products add constraint unique_sku_per_locale
unique ("SKU", locale); // this one creates a new unique constraint on two columns
Please note that I didn’t test this on production yet and it might cause problems, so please make sure you know what you’re doing.
this way, SKU will only be required to be unique in one locale.
@soupette please consider rethinking this design,
Thanks!