Rails application and multilingual content, Model dilemma
- by dakull
I'm writing in Rails a website that will be multilingual, for the application translation part i will use the simple I18n gem, for messages and everything related.
Yet, all the content must be translated, and we're talking about lots of pages, that will be stored into the database ( like articles, news, etc. )
For now, I'm thinking of two approaches:
Lets say i have a Pages table, the content in diff. languages, i will be storing it in a different table called PagesContent that will belong_to Pages and also to a Languages table.
The problem here, is that I'll essentially duplicate the no. of tables needed.
Pros: flexibility, in the box validation
To skip that duplication i can serialize a hash into the content column of Pages, containing the translation.
The problem here, is validation, arguably more code to write, and less flexibility when adding a new language.
Pros: Less tables.
Any other idea ?