How to use multi language support in my website ?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
shubhamdas.mca
Forum Newbie
Posts: 1
Joined: Thu Mar 04, 2010 8:49 am

How to use multi language support in my website ?

Post by shubhamdas.mca »

Hi

I have a website and I willing to make it multi language support.

So regarding this I request kindly sugest me anyone.

Thanks..
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: How to use multi language support in my website ?

Post by AbraCadaver »

There are many ways to do this. For a simple approach, I would store the multi-lingual content in the database with a language identifier:

main table

Code: Select all

id  lang    key         value
1   en      WELCOME     Welcome to my site
2   fr      WELCOME     Bienvenue sur mon site
You can have multiple tables for different content just as you would normally:

articles table

Code: Select all

id  lang    title           article
1   en      My Article      This is my article content.
1   fr      Mon article     Ceci est le contenu de mon article.
Then you have easy ways to get the correct data after you know the user's language:

Code: Select all

SELECT value FROM main WHERE key='WELCOME' AND lang='en'
 
SELECT * FROM articles WHERE id=1 AND lang='fr'
This makes it easy to add a form where different editors can translate stories, messages, etc.
Last edited by AbraCadaver on Mon Feb 28, 2011 10:57 am, edited 1 time in total.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: How to use multi language support in my website ?

Post by greyhoundcode »

AbraCadaver wrote:articles table

Code: Select all

 
id  title  article
1   en     My Article   This is my article content.
2   fr     Mon article  Ceci est le contenu de mon article.
Then you have easy ways to get the correct data after you know the user's language:

Code: Select all

SELECT value FROM main WHERE key='WELCOME' AND lang='en'
 
SELECT * FROM articles [color=#BF0000]WHERE id=1 AND lang='fr'[/color]
No entry matches that condition?
Post Reply