multi language setup in prisma
I have a question is there anyway to make a for example a model name hotel_en and hotel_fr and hotel_de dynamically so I can add multi language , or how can I create multi language similar to booking or expedia , trying to understand how big websites generates multi languages.
3 Replies
Hello @om3r 👋
There isn't a direct way in Prisma to dynamically create models for multiple languages like hotel_en, hotel_fr.
You could create a separate model for translations linked to your main model like this which stores translations like this:
You could do something like this as well:
thanks for the example but if I have like 1 million hotels with 7 languages , that will make the hotel table has 7 million records ? if so that will make the hotel table alot bigger also i will have to duplicate titles , description and it will make my database model has alot of records.
Other option would be to use a JSON column and store all translations in that column. That approach comes with different overheads though 😄