Multiple languages site?

Reply

Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Multiple languages site?

 
0
  #1
Oct 8th, 2008
hello all..

Tel me how to create a site with different languages, if user select particular language, then all the content will be displayed in that language...
How to do it???
or
Any predefined free software available on the internet...

Any resources or information would be appreciated....
Thanks..
Shanti.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 38
Reputation: kevindougans is an unknown quantity at this point 
Solved Threads: 1
kevindougans kevindougans is offline Offline
Light Poster

Re: Multiple languages site?

 
0
  #2
Oct 8th, 2008
I would normally just create a PHP file of definitions... name it after the language and include the correct file...

that way your code will never have to change and it's kept simple... i guess the only problem would be including variables... but depending on the type of site you have it may or not be a problem

if you needed variables within your output text I would then consider setting up a languages table in a database setup something like

ref | lang | output

then make a function called display() that would be called like
  1. echo display('welcome');
which would be defined like

  1. function display($ref, $var1)
  2. {
  3. global $lang;
  4. $info = mysql_fetch_array(mysql_query("select from languages where lang='$lang' and ref='$ref'"));
  5. $output = preg_replace($info['output']); // find out the regex to pickup and convert variables
  6. return $output;
  7. }
and welcome in the db would look like

ref | lang | output
welcome | en | Hi $var1, how the hell are you

this code is scribbled and i wouldn't use it, just to give you a rough idea.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC