Rails application and multilingual content, Model dilemma
Posted
by dakull
on Stack Overflow
See other posts from Stack Overflow
or by dakull
Published on 2010-04-22T10:41:53Z
Indexed on
2010/04/22
10:43 UTC
Read the original article
Hit count: 243
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 ?
© Stack Overflow or respective owner