Multi-Language Applications

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
VirtuosiMedia
Forum Contributor
Posts: 133
Joined: Thu Jun 12, 2008 6:16 pm

Multi-Language Applications

Post by VirtuosiMedia »

Are there best practices for creating a multiple language application? Specifically, I'd like to know about how the languages are organized and how they are included into the application.

The only way I've seen it is an application had variables for every phrase that was used in the application. All the variables were included in a single file and that file was included in every single place text was displayed. Translations were produced by creating a copy of that file and changing the values to the variables. Each language was placed in its own folder.

While that method worked, it kind of makes me cringe. I could improve on it by splitting the files up so that you only load what you need, but it still doesn't seem very elegant. Storing everything in a database is another option, but I like that even less.

Does anyone have any suggestions? Resources?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Multi-Language Applications

Post by Eran »

You should have a look at Zend_Translate - http://framework.zend.com/manual/en/zend.translate.html. It's a component for organizing translations and supports multiple file formats which are standard for this need.
Post Reply