Przeglądaj źródła

Fixes comments from review.

Adds a safe check, i18n is expecting undefined not null. Fix a method name and translation to be at placeholder.
master
damencho 9 lat temu
rodzic
commit
b2a1c9881e

+ 2
- 2
modules/UI/feedback/FeedbackWindow.js Wyświetl plik

@@ -146,10 +146,10 @@ export default class Dialog {
146 146
         this.submitted = false;
147 147
         this.onCloseCallback = function() {};
148 148
 
149
-        this.setDefaulOptions();
149
+        this.setDefaultOptions();
150 150
     }
151 151
 
152
-    setDefaulOptions() {
152
+    setDefaultOptions() {
153 153
         var self = this;
154 154
 
155 155
         this.options = {

+ 2
- 1
modules/UI/invite/InviteDialogView.js Wyświetl plik

@@ -156,7 +156,8 @@ export default class InviteDialogView {
156 156
                </label>
157 157
                 <div class="input-control__container">
158 158
                     <input class="input-control__input" id="newPasswordInput"
159
-                           type="text" data-i18n="dialog.createPassword">
159
+                           type="text" 
160
+                           data-i18n="[placeholder]dialog.createPassword">
160 161
                     <button id="addPasswordBtn" id="inviteDialogAddPassword"
161 162
                             disabled data-i18n="dialog.add"
162 163
                             class="button-control button-control_light">

+ 5
- 2
modules/translation/translation.js Wyświetl plik

@@ -98,7 +98,9 @@ module.exports = {
98 98
         return i18n.lng();
99 99
     },
100 100
     translateElement: function (selector, options) {
101
-        selector.i18n(options);
101
+        // i18next expects undefined if options are missing, check if its null
102
+        selector.i18n(
103
+            options === null ? undefined : options);
102 104
     },
103 105
     generateTranslationHTML: function (key, options) {
104 106
         var str = "<span data-i18n=\"" + key + "\"";
@@ -106,7 +108,8 @@ module.exports = {
106 108
             str += " data-i18n-options='" + JSON.stringify(options) + "'";
107 109
         }
108 110
         str += ">";
109
-        str += i18n.t(key, options);
111
+        // i18next expects undefined if options ARE missing, check if its null
112
+        str += i18n.t(key, options === null ? undefined : options);
110 113
         str += "</span>";
111 114
         return str;
112 115
 

Ładowanie…
Anuluj
Zapisz