1

Topic: Multilingual database patterns?

Hi all.

Am I tired of having to deal with multiple languages in my Websites.
Heres is what I always end up doing:
for every element that has text that is translated I create two tables:
element_index: stuff not translated (dates, file names, booleans)
element_content: all the text + a lang field + a id to the index table.

So now everytime I wuery something I just add
->where('lang=?', $lang)

and I get the right text.

My question is simply am I missing some very easy way to do what I want to do? It does'nt seem complicated but when I get into big products tables full of dynamic categories in there own tables (so every one has a matching content table) it makes for big querys.

Sorry for my English I am a french Canadian so if anything is'nt clear just ask. For what its worth I really want a discussion on translation of stuff queryed from a db.

Thanks in advance!

edit: Ever since I started using models the translation stuff has gotten a little less heavy since I just take care of it in the constructor for my zend_db models. Used to be I had to add a lang variable everywhere ouch.

Last edited by iznogood (2010-01-11 18:20:50)

2

Re: Multilingual database patterns?

'My question is simply am I missing some very easy way to do what I want to do?'

Yes. Look up Zend_Translate in the manual. You can use a db to store translations.. but its more common to use files instead.

3

Re: Multilingual database patterns?

I know about zend_translate. But I did'nt know it could automate the translation of stuff in my database. For instance news on a website that users can add to from a CMS.
I use zend_translate all the time to translate static text on my projects.

I'll look into that.
Thanks!

4

Re: Multilingual database patterns?

Sorry for takling so long to return but I am pretty occupied.
I searched and all I could find concerning a Zend_Translate + Zend_Db adapter is this
http://framework.zend.com/issues/browse/ZF-2248
Wich states its not ready yet but in development. I might try to make one myself. Should'nt be too complicated.