Is it possible in php to write this so that, if there's a directory for the specified language then it's used, so that we don't have to list all of the language codes in this php file? Otherwise, each time we add a language we have to remember to edit this file...

Doug

Stefan Groschupf wrote:
I found this and on my server it works ok.
May someone wish to test it as well  and add required languages.

HTH
Stefan

<?php
//check first to see if they've been nice and
//set the language
if (isset($_SERVER["HTTP_ACCEPT_language"])) {

//grab all the languages
$langs=explode(",",$_SERVER["HTTP_ACCEPT_language"]);

//start going through each one
foreach ($langs as $value) {

//select only the first two letters
$choice=substr($value,0,2);

//redirect to the different language page
//based on their first chosen language
switch ($choice) {
case "fr":
Header("Location: ./fr/");
exit;
case "en":
Header("Location: ./en/");
exit;
case "es":
Header("Location: ./es/");
exit;
}
}
}

//If the language is not set then use this
//as default
else {
Header("Location: ./en/");
}
?>


--------------------------------------------------------------- enterprise information technology consulting open technology: http://www.media-style.com open discussion: http://www.text-mining.org open thoughts: http://www.find23.net



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Nutch-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nutch-developers


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Nutch-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nutch-developers

Reply via email to