vendredi 24 décembre 2021

Rails tables in different languages

I'm building a multilang application, which should be support French and Flemish (there are multiple models/tables; but these two can change in the future, it needs to be dynamic)

So I want the ability to display the same "attribute" with more than a language, for example, consider a category called Cars. Lets say that it should have a color in french & flemish (amongst other characteristics).

I'm assuming the Model would stay the same, but maybe in the database it would be something like this (I don't know if it's possible)

#<Model id: 4, name: "Model 4", color:"{fr: "noir", nl:"zwart"}">

This is an example of how the its seen from the view:[1]

As you can see, the idea's not to create two Models, one in each language, for that one to contain information in both languages

Thank you

Aucun commentaire:

Enregistrer un commentaire