Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Multi Language Sites

Best way to do it.

9:01 pm on Dec 10, 2007 (gmt 0)

Junior Member

5+ Year Member

joined:July 28, 2006
posts: 168
votes: 0

Hello I am planning to build a PHP/MySQL based product/category site. It needs to be able to display both English and French. The way I would structure the database would be:



And so forth... which isn't too bad, however what about for the static content on all the pages? I was thinking just making it session based and every peice of content would need an if statment.... so for example....

if($_SESSION['lang'] == "english"){
english content here...
french content here...

This seems like alot of work for just static content but it seems like the only way... or does anyone else have suggestions?


10:02 pm on Dec 10, 2007 (gmt 0)

Moderator from US 

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 10, 2005
votes: 24

You can put the static text in text files and just read the appropriate file based on the language.
11:22 pm on Dec 10, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:May 4, 2004
votes: 0

What I have used to do is to store every piece of text in database (even if only two languages are needed), and there's an another table, which maps the texts to pages, and each time a page is loaded the mapped texts are automatically loaded into a variable (well, I used the oop approach, so it is not a simple variable), and when a text has to be displayed, a function is called, which returns the the text (using the selected language) by using a codename (defined for each text). Although not sure my description is clear, that's the way I found for myself.

Quite some other products chosen to make include files which are defining hundreds of constants (for each language), and then it uses these constants for displaying texts.

Whatever you choose, don't forget to check out the printf() [php.net] series of functions as they come very handy when dealing with multilingual content.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members