From 0e93f595240397b782cc6cf489634ed793cd7cf2 Mon Sep 17 00:00:00 2001 From: james Date: Tue, 30 Nov 2004 18:52:31 +0000 Subject: [PATCH] add default language and language detection xhtml 1.0 transitional compliance changes --- common.inc.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/common.inc.php b/common.inc.php index 91b9a2f7..2aea79ba 100644 --- a/common.inc.php +++ b/common.inc.php @@ -32,6 +32,16 @@ else $config['languages'][$r->lang]=$r->langname; } } +//now if no language has been set yet, lets set it to the default language +if(!$_SESSION['lang']) +{ + //first try the default language, if that doesnt work, use "en" + if($config['default_language']) + $_SESSION['lang']=$config['default_language']; + else + $_SESSION['lang']="en"; +} + //if the user has switched languages, go ahead and switch the session variable if($_GET['switchlanguage']) @@ -46,7 +56,6 @@ if($_GET['switchlanguage']) { //invalid language, dont do anything } - } @@ -118,16 +127,18 @@ echo "

".i18n($config['FAIRNAME'])."

";
  • +
    1) { - echo "
    "; - echo "\n"; foreach($config['languages'] AS $key=>$val) { - if($_SESSION['lang']==$key) $selected="selected"; else $selected=""; + if($_SESSION['lang']==$key) $selected="selected=\"selected\""; else $selected=""; echo ""; } @@ -137,12 +148,8 @@ if(count($config['languages'])>1) ?> - - -
    -

    -

    +