...

View Full Version : using language files



MrK
08-11-2007, 02:07 PM
I have a script which is in English, but i need this script to show both English and German.

the English language already has a language file ( english.php ), so i am going to translate all the English wording to German ( german.php )

so my question is how can i select the language file,
i am going to let the user select the language via a flag image

so when the user clicks on there country flag it will change the site to the requested language etc etc

i want to use separate language files

but how ?

Thanks MrK

Mwnciau
08-11-2007, 02:43 PM
You could do something like:



<?php session_start(); ?>
<a href="index.php?lang=eng"> English </a> <a href="index.php?lang=ger"> German </a>

<?php
if(!empty($_GET['lang'])){
if($_GET['lang'] == 'eng') $lang = 'english';
if($_GET['lang'] == 'ger') $lang = 'german';
} elseif (!empty($_SESSION['lang'])){
$lang = $_SESSION['lang']
}
if ($lang != 'english' && $lang != 'german'){
$lang = 'english';
}

$_SESSION['lang'] = $lang;
include $lang.'.php';
?>

MrK
08-11-2007, 02:54 PM
thank you, i will give this a try later after work

thanks again

mrk

MrK
08-20-2007, 10:26 PM
Thanks for the help , got it working

:thumbsup: :eek:

mrk



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum