[Lada-commits] [PATCH 1 of 2] Improve readability

Wald Commits scm-commit at wald.intevation.org
Thu Apr 6 14:30:22 CEST 2017


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1491473879 -7200
# Node ID 68e579063a47b9a0b049135a25c2a41707b79ffe
# Parent  44d28e46cc4b1ed571ea5ad7843f6d75864981f6
Improve readability.

diff -r 44d28e46cc4b -r 68e579063a47 app/view/window/ImportResponse.js
--- a/app/view/window/ImportResponse.js	Thu Apr 06 12:13:45 2017 +0200
+++ b/app/view/window/ImportResponse.js	Thu Apr 06 12:17:59 2017 +0200
@@ -120,6 +120,7 @@
      * @param data the payload of the response
      */
     parseResponse: function(data) {
+        var i18n = Lada.getApplication().bundle;
         var errors = data.data.errors;
         var warnings = data.data.warnings;
         var out = [];
@@ -165,13 +166,16 @@
                         if (msgs[i].key === 'validation') {
                             validation.push('<ol>');
                             var parts = msgs[i].value.split('#');
-                            var str = Lada.getApplication().bundle.getMsg(parts[0]) +
+                            var str = i18n.getMsg(parts[0]) +
                                 parts[1] === undefined ? '' : parts[1];
-                            validation.push(str + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString()) + ')');
+                            validation.push(str + ' ('
+                                + i18n.getMsg(msgs[i].code.toString()) + ')');
                             validation.push('</ol>');
                         }
                         else {
-                            out.push('<li>' + msgs[i].key + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString())+'): '+msgs[i].value+'</li>')
+                            out.push('<li>' + msgs[i].key + ' ('
+                                     + i18n.getMsg(msgs[i].code.toString())
+                                     + '): ' + msgs[i].value + '</li>')
                         }
                     }
                     if (validation.length > 1) {
@@ -202,13 +206,16 @@
                         if (msgs[i].key === 'validation') {
                             validation.push('<ol>');
                             var parts = msgs[i].value.split('#');
-                            var str = Lada.getApplication().bundle.getMsg(parts[0]) +
+                            var str = i18n.getMsg(parts[0]) +
                                 parts[1] === undefined ? '' : parts[1];
-                            validation.push(str + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString()) + ')');
+                            validation.push(str + ' ('
+                                + i18n.getMsg(msgs[i].code.toString()) + ')');
                             validation.push('</ol>');
                         }
                         else {
-                            out.push('<li>' + msgs[i].key + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString())+'): '+msgs[i].value+'</li>')
+                            out.push('<li>' + msgs[i].key + ' ('
+                                     + i18n.getMsg(msgs[i].code.toString())
+                                     + '): ' + msgs[i].value + '</li>')
                         }
                     }
                     if (validation.length > 1) {


More information about the Lada-commits mailing list