Changes

Jump to navigation Jump to search

Talk:Main Page

1,580 bytes added, 03:28, 17 June 2006
no edit summary
Would it be possible for Wurmpedia to detect the language preference of the visitor's browser and redirect those who chose fr, fr-CA, fr-FR, fr-BE, fr-CH and on to [[Fr:Page principale]]? --[[User:Kanif|Kanif]] 22:10, 16 June 2006 (CDT)
 
 
 
That would be possible if we asked Egal to make a script that does it. For example there is a wiki.php script which is executed when the user clicks "Wiki" in the menu, instead of going straight to the wiki, then the wiki.php script finds the language and redirects the user onwards.
 
<?php
// Language Redirect Script by Graham Edgecombe aka Ancient
//
// Find the user's language
$language = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
// Default it to English if it is not set by the browser
if(!isset($language))
{
$language = "en";
}
// A list of all the languages supported and their "Main Page" names is defined here
$languages_supported = array
(
"en" => "Main Page"
"fr" => "Page principale"
"de" => "Hauptseite"
);
// Checks to see if the users language is supported
if(isset($languages_supported[$language]))
{
// If so redirect them to their language's home page which is "language code":"Main Page in that language" - of course this means English goes to "En:Main Page" so we will have to make a redirect in the wiki to go back to "Main Page"
header("Location: http://www.wurmonline.com/wiki/" . $language . ":" . $languages_supported[$language]);
} else {
// Otherwise redirect them to the Main Page, this could also be another page saying that the language is not supported
header("Location: http://www.wurmonline.com/wiki/Main Page");
}
?>
 
--[[User:Ancient|Ancient]] 05:28, 17 June 2006 (CDT)
773

edits

Navigation menu