Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

small update for user override

  • Loading branch information...
commit 4d7334d95c35c4699502cee89b2ec851438ba7a6 1 parent 214584a
ossreleasefeed authored
Showing with 17 additions and 2 deletions.
  1. +13 −1 demos/java/web/index.jsp
  2. +4 −1 i18n.js
View
14 demos/java/web/index.jsp
@@ -23,6 +23,10 @@
</head>
<body>
<h1>Sign Up</h1>
+ <ul id="langswitch">
+ <li><a href="#switchlang" lang="fr">French</a></li>
+ <li><a href="#switchlang" lang="de">German</a></li>
+ </ul>
<form name="signup" id="signup" action="./" method="post">
<fieldset>
<div class="elem_group">
@@ -65,6 +69,14 @@
$(errorContainer).append(i18n.msgStore[msgKey]).insertAfter(ctx);
};
+ // Overriding language set based on user selection
+ $("#langswitch a").each(function() {
+ $(this).click(function(event) {
+ event.preventDefault();
+ i18n.userSelected($(this).attr("lang"));
+ });
+ });
+
$("#first_name").blur(function(event) {
var nameErr = $(this).next(".error");
@@ -105,4 +117,4 @@
});
</script>
</body>
-</html>
+</html>
View
5 i18n.js
@@ -40,6 +40,9 @@
}
});
},
+ userSelected: function(lang) {
+ this.setLanguage(lang);
+ },
init: function(options) {
var localMsgStore = "";
@@ -62,4 +65,4 @@
/* Expose i18n to the global object */
window.i18n = i18n;
-})(window);
+})(window);
Please sign in to comment.
Something went wrong with that request. Please try again.