Yii: Multi-language website - best practices.
Posted
by michal
on Stack Overflow
See other posts from Stack Overflow
or by michal
Published on 2010-03-23T02:12:31Z
Indexed on
2010/03/26
3:23 UTC
Read the original article
Hit count: 637
Hi, I find Yii great framework, and the example website created with yiic shell is a good point to start... however it doesn't cover the topic of multi-language websites, unfortunately. The docs covers the topic of translating short messages, but not keeping the multi-lingual content ...
I'm about to start working on a website which needs to be in at least two languages, and I'm wondering what is the best way to keep content for that ... The problem is that the content is mixed extensively with common elements (like embedded video files).
I need to avoid duplicating those commons ... so far I used to have an array of arrays containing texts (usually no more than 1-2 short paragraphs), then the view file was just rendering the text from an array.
Now I'd like to avoid keeping it in arrays (which requires some attention when putting double quotations " " and is inconvenient in general...).
So, what is the best way to keep those short paragraphs? Should I keep them in DB like (id | msg_id | language | content ) and then select them by msg_id & language? That still requires me to create some msg_id's and embed them into view file ...
Is there any recommended paradigm for which Yii has some solutions?
Thanks, m.
© Stack Overflow or respective owner