dojo-based locale switcher
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Jul 2008 03:56:24 +0000 (03:56 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Jul 2008 03:56:24 +0000 (03:56 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10201 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/skin/default/xml/common/js_common.xml
Open-ILS/web/opac/skin/default/xml/footer.xml

index b390e8d..b89dacf 100644 (file)
 
     <!-- enable Dojo date picker -->
     <script language='javascript' type="text/javascript">
 
     <!-- enable Dojo date picker -->
     <script language='javascript' type="text/javascript">
+
         var djConfig = {parseOnLoad: true, isDebug: false},
         var djConfig = {parseOnLoad: true, isDebug: false},
-            locale,
             lang,
             bidi;
 
             lang,
             bidi;
 
-        djConfig.locale = '<!--#echo var="locale"-->';
+        var locale = location.href.match( /opac\/([^\/]+)\/skin/ )[0];
+        if (!locale) locale = '<!--#echo var="locale"-->';
+
+        djConfig.locale = locale;
+
     </script>
 
     <script type="text/javascript" src='/js/dojo/dojo/dojo.js'></script>
     </script>
 
     <script type="text/javascript" src='/js/dojo/dojo/dojo.js'></script>
@@ -51,4 +55,6 @@
         dojo.require("dojo.date.locale");
         dojo.require("dojo.date.stamp");
         dojo.require("dojo.parser");
         dojo.require("dojo.date.locale");
         dojo.require("dojo.date.stamp");
         dojo.require("dojo.parser");
+        dojo.require("openils.I18N");
+        dojo.require("dijit.form.FilteringSelect");
     </script>
     </script>
index d74a0ca..02c6704 100644 (file)
         <div id='footer_logo'>&footer.logo;
             <a href='http://open-ils.org'><img style='border:none;' src='../../../../images/eg_tiny_logo.jpg'/></a>
         </div>
         <div id='footer_logo'>&footer.logo;
             <a href='http://open-ils.org'><img style='border:none;' src='../../../../images/eg_tiny_logo.jpg'/></a>
         </div>
+
+        <div id='translation_switch' dojoType="dijit.form.FilteringSelect" store="openils.I18N.localeStore" searchAttr="locale" displayAttr="label">
+            <script type="dojo/connect" event="onChange">
+                if (this.getValue()) {
+                    location.href.replace( /opac\/[^\/]+\/skin/, 'opac/' + this.getValue() + '/skin');
+                }
+            </script>
+        </div>
 </div>
 </div>