Jeremy Newman : language plugin now has a list command

Jeremy Newman jnewman at winehq.org
Fri Oct 15 09:36:26 CDT 2010


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

Author: Jeremy Newman <jnewman at codeweavers.com>
Date:   Fri Oct 15 09:35:12 2010 -0500

language plugin now has a list command

---

 include/plugins/language.php |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/include/plugins/language.php b/include/plugins/language.php
index a785430..c4e19bd 100644
--- a/include/plugins/language.php
+++ b/include/plugins/language.php
@@ -6,14 +6,32 @@
     by Jeremy Newman <jnewman at codeweavers.com>
 */
 
-global $html, $config;
+global $html, $config, $data;
 
-// if specified, switch to lang
-if (defined('PAGE_PARAMS') and in_array(PAGE_PARAMS, $config->languages))
+switch ($this->params['cmd'])
 {
-    setcookie("lang", PAGE_PARAMS, time()+60*60*24*365, "{$config->base_root}/");
-    $html->redirect($config->base_url);
-    exit();
+    // list languages
+    case "list":
+        foreach ($config->languages as $lang)
+        {
+            $row = array(
+                         'lang'     => $lang,
+                         'langFull' => $data->languages[$lang]['name'],
+                         'langHelp' => $data->languages[$lang]['change']
+                        );
+            echo $html->template('local', 'global/lang_row', $row, 1);
+        }
+        break;
+
+    // set the language based on the URL
+    default:
+        // if specified, switch to lang
+        if (defined('PAGE_PARAMS') and in_array(PAGE_PARAMS, $config->languages))
+        {
+            setcookie("lang", PAGE_PARAMS, time()+60*60*24*365, "{$config->base_root}/");
+            $html->redirect($config->base_url);
+            exit();
+        }
 }
 
 ?>




More information about the wine-cvs mailing list