cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [47/50] git commit: updated refs/heads/saml2 to 09da909
Date Sat, 16 Aug 2014 10:56:18 GMT
CLOUDSTACK-7293: UI: Fixed localization issues on the login page

- Reverted the validator.messages to the original values (jquery.validator.js).
- Added a function to localize validator.messages which is called before login.

Signed-off-by: Brian Federle <brian.federle@citrix.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f212aa57
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f212aa57
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f212aa57

Branch: refs/heads/saml2
Commit: f212aa57c32eb05d6a69730e37ac50bdb1f0a268
Parents: aac8b91
Author: Mihaela Stoica <mihaela.stoica@citrix.com>
Authored: Fri Aug 8 15:19:50 2014 +0100
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Fri Aug 15 10:51:28 2014 -0700

----------------------------------------------------------------------
 ui/lib/jquery.validate.js | 34 +++++++++++++++++-----------------
 ui/scripts/cloudStack.js  |  7 +++++--
 ui/scripts/ui/utils.js    | 25 +++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f212aa57/ui/lib/jquery.validate.js
----------------------------------------------------------------------
diff --git a/ui/lib/jquery.validate.js b/ui/lib/jquery.validate.js
index 2ee3961..72296a6 100644
--- a/ui/lib/jquery.validate.js
+++ b/ui/lib/jquery.validate.js
@@ -260,23 +260,23 @@ $.extend($.validator, {
 	},
 
 	messages: {
-		required: 'message.validate.fieldrequired',
-		remote: 'message.validate.fixfield',
-		email: 'message.validate.email.address',
-		url: 'message.validate.URL',
-		date: 'message.validate.date',
-		dateISO: 'message.validate.date.ISO',
-		number: 'message.validate.number',
-		digits: 'message.validate.digits',
-		creditcard: 'message.validate.creditcard',
-		equalTo: 'message.validate.equalto',
-		accept: 'message.validate.accept',
-		maxlength: $.validator.format('message.validate.maxlength'),
-		minlength: $.validator.format('message.validate.minlength'),
-		rangelength: $.validator.format('message.validate.range.length'),
-		range: $.validator.format('message.validate.range'),
-		max: $.validator.format('message.validate.max'),
-		min: $.validator.format('messgae.validate.min')
+		required: "This field is required.",
+		remote: "Please fix this field.",
+		email: "Please enter a valid email address.",
+		url: "Please enter a valid URL.",
+		date: "Please enter a valid date.",
+		dateISO: "Please enter a valid date (ISO).",
+		number: "Please enter a valid number.",
+		digits: "Please enter only digits.",
+		creditcard: "Please enter a valid credit card number.",
+		equalTo: "Please enter the same value again.",
+		accept: "Please enter a value with a valid extension.",
+		maxlength: $.validator.format("Please enter no more than {0} characters."),
+		minlength: $.validator.format("Please enter at least {0} characters."),
+		rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
+		range: $.validator.format("Please enter a value between {0} and {1}."),
+		max: $.validator.format("Please enter a value less than or equal to {0}."),
+		min: $.validator.format("Please enter a value greater than or equal to {0}.")
 	},
 
 	autoCreateRanges: false,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f212aa57/ui/scripts/cloudStack.js
----------------------------------------------------------------------
diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js
index 2285276..b6dd559 100644
--- a/ui/scripts/cloudStack.js
+++ b/ui/scripts/cloudStack.js
@@ -480,8 +480,6 @@
             loginArgs.hideLoginScreen = true;
         }
 
-        cloudStack.uiCustom.login(loginArgs);
-
         // Localization
         if (!$.isFunction(cloudStack.localizationFn)) { // i.e., localize is overridden by
a plugin/module
             cloudStack.localizationFn = function(str) {
@@ -489,6 +487,11 @@
             };
         }
 
+        // Localize validation messages
+        cloudStack.localizeValidatorMessages();
+
+        cloudStack.uiCustom.login(loginArgs);
+
         document.title = _l('label.app.name');            
     });
 })(cloudStack, jQuery);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f212aa57/ui/scripts/ui/utils.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/utils.js b/ui/scripts/ui/utils.js
index 769aea7..542365a 100644
--- a/ui/scripts/ui/utils.js
+++ b/ui/scripts/ui/utils.js
@@ -120,4 +120,29 @@
             return str;
         }
     };
+
+    /**
+     * Localize validator messages
+     */
+    cloudStack.localizeValidatorMessages = function() {
+        $.extend($.validator.messages, {
+            required: _l('message.validate.fieldrequired'),
+            remote: _l('message.validate.fixfield'),
+            email: _l('message.validate.email.address'),
+            url: _l('message.validate.URL'),
+            date: _l('message.validate.date'),
+            dateISO: _l('message.validate.date.ISO'),
+            number: _l('message.validate.number'),
+            digits: _l('message.validate.digits'),
+            creditcard: _l('message.validate.creditcard'),
+            equalTo: _l('message.validate.equalto'),
+            accept: _l('message.validate.accept'),
+            maxlength: $.validator.format(_l('message.validate.maxlength')),
+            minlength: $.validator.format(_l('message.validate.minlength')),
+            rangelength: $.validator.format(_l('message.validate.range.length')),
+            range: $.validator.format(_l('message.validate.range')),
+            max: $.validator.format(_l('message.validate.max')),
+            min: $.validator.format(_l('messgae.validate.min'))
+        });
+    };
 })(jQuery, cloudStack);


Mime
View raw message