i want to put the link for other language...if i click on that language the site will convert to that language...plz can anyone help me...its urgent...
thnks in advance...

Recommended Answers

All 3 Replies

Member Avatar

its urgent...

Not to us it's not. You can use a number of approaches:

1) PHP array items

For beginners, the first method would probably be the easiest.

All you do is create files like these...


    $lang = array(
        'hi' => 'Hi, how are you?';
        'bye'=> 'Bye!';


    $lang = array(
        'hi' => 'Salve, come stai?';
        'bye'=> 'Addio!';

Have a link to set the language, somthing like this:

$defaultLang = 'it';

if(isset($_GET['lang']) && in_array($_GET['lang'], array('en','it')))
   $lang = $_GET['lang']; 
    $lang = $_SESSION['lang'];
    $lang = $defaultLang;

$_SESSION['lang'] = $lang;
require "lang/$lang.php";


<p><?php echo $lang['hi'];?></p>

If you want to use GETTEXT see here:





i don't want to convert a single page to other language...want my website to other language...

Member Avatar

That will do it. But you must provide translations whatever you do. The 'session' keeps track of the language. You could even add a cookie read/write for users that return - so that the site remembers their language.

An alternative method would be to store multiple versions of your site in different folders - but that's daft IMO.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.