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???
Any predefined free software available on the internet...

Any resources or information would be appreciated....

8 Years
Discussion Span
Last Post by kevindougans

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

echo display('welcome');

which would be defined like

function display($ref, $var1)
global $lang;
$info = mysql_fetch_array(mysql_query("select from languages where lang='$lang' and ref='$ref'"));
$output = preg_replace($info['output']); // find out the regex to pickup and convert variables
return $output;

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.