HI i want to display multiple langauges in my site,when user visit and he can change language.how to code multiple language for my site using php code.is there any free scripts .please help me...
urgent requirement
multiple langauge
Moderator: General Moderators
Re: multiple langauge
Have you tried google? Try this in the search box: php select language script
Re: multiple langauge
Basically it works like this: You determine the user's language, then pull strings from that language's file.
Example:
en.lang.inc
es.lang.inc
Main page
A user that's chosen English will get "Hello user, would you like a beer?". A user that's chosen Spanish will get "Hola user, would you like a cerveza?"
Example:
en.lang.inc
Code: Select all
$lang['greeting'] = 'Hello';
$lang['beer'] = 'beer';Code: Select all
$lang['greeting'] = 'Hola';
$lang['beer'] = 'cerveza';Code: Select all
//Somehow determine their language. Either from the headers sent from their browser, a form they've entered, or read from the database from a previous page load;
$user_lang = 'en';//just as an example:
//include only the language file for the user's file
include $user_lang.'.lang.inc';
echo $lang['greeting'].' user, would you like a '.$lang['beer'].'?';Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: multiple langauge
Hold on there! Shouldn't that be: Hola usario, quieres una cerveza? /sarcasmA user that's chosen English will get "Hello user, would you like a beer?". A user that's chosen Spanish will get "Hola user, would you like a cerveza?"
Re: multiple langauge
thank you for replies.