Added drop down locale selection to the footer. Fixed random syntax errors. Still need to create an external file with all of the individual language names in their native character set for the drop down. l10n
authorMark Hahnenberg <mhahnenberg@mozilla.com>
Thu, 30 Jul 2009 11:39:04 -0700
branchl10n
changeset 1115 810282f5ebb67286fae94d93363057664f872d10
parent 1114 117d9501f8675c03537e08e8a473e1feaf1d57e4
child 1116 1d622e6127fee584a38d2386e6869167059b6e31
push id723
push usermhahnenberg@mozilla.com
push dateTue, 04 Aug 2009 17:32:53 +0000
Added drop down locale selection to the footer. Fixed random syntax errors. Still need to create an external file with all of the individual language names in their native character set for the drop down.
server/templates/footer.php
server/templates/gallery.php
server/templates/get_personas.php
--- a/server/templates/footer.php
+++ b/server/templates/footer.php
@@ -1,19 +1,32 @@
     <div id="footer">
         <form class="languages go" method="get" action="">
         <div>
             <label for="language"><?= _("Other languages:");?></label>
-            <select id="language" name="lang" dir="ltr">
-                <option value="en-US" selected="selected">English (US)</option>
+            <select id="language" name="lang" dir="ltr" target="_parent._top">
+                <?
+                    // TODO: We need to add the localized version of each language (e.g. "Chinese" in literal Chinese characters)
+                    foreach ($locale_conf->_supported_languages as $lang => $lang_code) {
+                        echo "<option value=\"$lang\" " . ($lang == $locale_conf->current_language ? "selected=\"selected\" " : "") . ">$lang</option>";
+                    }
+                ?>
             </select>
-            <button>Go</button>
         </div>
         </form>
 
         <p><?printf(_("Copyright &copy; %s Mozilla.") . _(" <a href=\"http://labs.mozilla.com/projects/firefox-personas/\">Personas</a> is a <a href=\"http://labs.mozilla.com\">Mozilla Labs</a> experiment. | <a href=\"http://labs.mozilla.com/about-labs/\">") . _("About Mozilla Labs") . "</a>    |  <a href=\"%s\">" . _("Privacy") . "</a>", date("Y"), $locale_conf->url('/privacy'));?></p>
     </div>
 
     
 	<script src="/static/js/urchin.js"></script>
     <script type="text/javascript">
-          urchinTracker();
+        urchinTracker();
+        $(function () {
+            $('#language').change(function() {
+                var lang = $("#language option:selected").attr('value');
+                window.location.replace(location.href.replace("<?= $locale_conf->current_language;?>", lang));
+            });
+            $('#language').click(function() {
+                this.focus();
+            });
+        });
     </script>
--- a/server/templates/gallery.php
+++ b/server/templates/gallery.php
@@ -18,17 +18,30 @@
 		}
 ?>
 			<div id="header">
                 <h2><?= $page_header ?></h2>
                 <h3><?= $header_text ?></h3>
             </div>
 <?php } ?>
 			<div id="maincontent">
-                <p id="breadcrumbs"><?printf("<a href=\"%s\">" . _("Personas Home") . "</a> : <a href=\"%s\">" . _("Gallery") . "</a> : %s<? if ($category == 'Designer') { echo " : $display_username"; } else if ($tab != \"All\") { echo \" : $tab\"; } ?>", $locale_conf->url('/'), $locale_conf->url('/gallery/All/Popular'), $category);?></p>
+                <p id="breadcrumbs">
+                    <?
+                        $append_extra = "";
+                        if ($category == 'Designer')
+                            $append_extra = " : $display_username";
+                        else if ($tab != "All")
+                            $append_extra = " : $tab";
+                        printf("<a href=\"%s\">" . _("Personas Home") . "</a> : <a href=\"%s\">" . _("Gallery") . "</a> : %s%s", 
+                            $locale_conf->url('/'), 
+                            $locale_conf->url('/gallery/All/Popular'), 
+                            $category, 
+                            $append_extra);
+                    ?>
+                </p>
                 <div id="gallery">
 <?php
 			
 			if ($tab == 'Search')
 			{
 ?>  
 			
 <?php
--- a/server/templates/get_personas.php
+++ b/server/templates/get_personas.php
@@ -26,17 +26,17 @@
 <?php if (preg_match('/faq/', $_SERVER['SCRIPT_URL'])) { ?>
                 <li class="current">
                     <div class="wrapper">
                         <span><?= _("Frequent Questions");?></span>
                     </div>
                 </li>
 <?php } else { ?>
                 <li> 
-					<?printf("<a href=\"%s\">" . _("Frequent Questions") . "</a>", $locale_conf->url('faq'));?>
+					<?printf("<a href=\"%s\">" . _("Frequent Questions") . "</a>", $locale_conf->url('/faq'));?>
 				</li>
 <?php } ?>
               </ol>
               <div class="info-box">
                 <h3><a href="<?php echo PERSONAS_ADDON_URL ?>" id="getpersonas"><?= _("Get Personas Free");?></a></h3>
                 <div class="body">
                     <p><?= _("Easy to install and easy to change \"skins\" for your Firefox web browser.");?></p>
                 </div>