Rails and multilingual content, the model dilemma

I am writing a website in Rails that will be multilingual, for the translation part of the application I will use a simple I18n gem, for posts and everything related.

However, all content needs to be translated and we are talking about multiple pages that will be stored in the database (e.g. articles, news, etc.).

I am currently thinking of two approaches:

1. They say I have a Pages table, content in diff. Languages, I will store it in another table called PagesContent that will be owned by the pages, as well as the Languages ​​table.

The problem here is that I am essentially duplicating no. required tables. Pros: flexibility in checking the box

2.To skip this duplication, I can serialize the hash in the Pages content column containing the translation.

The problem here is validation, perhaps more code to write and less flexibility when adding a new language. Pros: fewer tables.

Any other idea?

+2


a source to share


1 answer


How about using globalize ? It is a gem designed to make it all easier.



+3


a source







All Articles