System Information
- Strapi Version: 4.25.13
- Operating System: Developing on MacOS
- Database: Developing with SQLite
- Node Version: 18.19.0
- NPM Version: 10.2.3
- Yarn Version:
I had to learn the hard way that Strapi simply creates new records for each language variant. New record = new ID. While this works fine for something like a website or maybe a blog, where the ID is not important, I’m unable to figure out how to do this in my rental application:
I have a set of “Rental” records which then get listed on a web page. The user can select a rental object and book it for a certain time. However, since the rental object “A” in English is in fact a different record than in French, when someone books the object in English, it is still available in French
So I thought I’d be smart and turn of internationalisation on the “Rental” object, moving all text fields to a “RentalDescription” object and giving the “Rental” object a “has one” relationship to the “RentalDescription” object. In the “RentalDescription” record, internationalisation is turned on. This seemed to work, however, the API is only returning the default language RentalDescription data with the Rental data… probably because the “has one” relationship works with the foreign key ID of the RentalDescription object, and – as I found out before – each language variant has a new ID. So again.
Has anyone figured out, how to solve this problem?
I have worked with another CMS for many years where the language variants are not stored in new records, but rather in the same record with new fields (e.g. title for the default language and title_fr for the French variant). This works quite nicely, so apologies if I’m having a hard time wrapping my head around the Strapi way of doing things…