Jeremy Newman : use available languages from site config file, not hard coded into config lib

Jeremy Newman jnewman at winehq.org
Thu May 29 16:26:34 CDT 2008


Module: website
Branch: master
Commit: 044886f0994aaff064bedbb418d5cd3a1ef3fbaf
URL:    http://source.winehq.org/git/website.git/?a=commit;h=044886f0994aaff064bedbb418d5cd3a1ef3fbaf

Author: Jeremy Newman <jnewman at jnewman.codeweavers.com>
Date:   Thu May 29 16:14:39 2008 -0500

use available languages from site config file, not hard coded into config lib

---

 include/config.php |    3 ---
 include/html.php   |    7 +++----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/include/config.php b/include/config.php
index 7ec30fc..a5f1fe2 100644
--- a/include/config.php
+++ b/include/config.php
@@ -30,9 +30,6 @@ class config
             $this->readConfig($path);
         }
         
-        // define avialable languages
-        $this->langs_avail = array('en', 'es');
-        
         // navigation
         $this->nav = array(
             'WineHQ Menu' => array(
diff --git a/include/html.php b/include/html.php
index 8f78427..af93eba 100644
--- a/include/html.php
+++ b/include/html.php
@@ -40,12 +40,12 @@ class html
         if (isset($_GET['lang']) or isset($_COOKIE['lang']))
         {
             // load language from URL or cookie
-            if (isset($_GET['lang']) and in_array($_GET['lang'], $GLOBALS['config']->langs_avail))
+            if (isset($_GET['lang']) and in_array($_GET['lang'], $GLOBALS['config']->languages))
             {
                 // load from URL
                 $lang = $_GET['lang'];
             }
-            else if (isset($_COOKIE['lang']) and in_array($_COOKIE['lang'], $GLOBALS['config']->langs_avail))
+            else if (isset($_COOKIE['lang']) and in_array($_COOKIE['lang'], $GLOBALS['config']->languages))
             {
                 // load from COOKIE
                 $lang = $_COOKIE['lang'];
@@ -56,7 +56,6 @@ class html
         else if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
         {
             // load from web browser environment
-            $avail = get_files($this->_file_root."/templates", "DIR");
             $lang = split(',', array_shift(split(";", $_SERVER["HTTP_ACCEPT_LANGUAGE"])));
             if (isset($lang[0]))
             {
@@ -64,7 +63,7 @@ class html
                 if (strlen($lang[0]) > 2)
                     $lang[0] = substr($lang[0], 0, 2);
                 // check to make sure lang is defined in our config
-                if (in_array($lang[0], $GLOBALS['config']->langs_avail))
+                if (in_array($lang[0], $GLOBALS['config']->languages))
                     $lang = $lang[0];
             }
         }




More information about the wine-cvs mailing list