浏览代码

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 年前
父节点
当前提交
b2a1c9881e
共有 3 个文件被更改,包括 9 次插入5 次删除
  1. 2
    2
      modules/UI/feedback/FeedbackWindow.js
  2. 2
    1
      modules/UI/invite/InviteDialogView.js
  3. 5
    2
      modules/translation/translation.js

+ 2
- 2
modules/UI/feedback/FeedbackWindow.js 查看文件

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

+ 2
- 1
modules/UI/invite/InviteDialogView.js 查看文件

156
                </label>
156
                </label>
157
                 <div class="input-control__container">
157
                 <div class="input-control__container">
158
                     <input class="input-control__input" id="newPasswordInput"
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
                     <button id="addPasswordBtn" id="inviteDialogAddPassword"
161
                     <button id="addPasswordBtn" id="inviteDialogAddPassword"
161
                             disabled data-i18n="dialog.add"
162
                             disabled data-i18n="dialog.add"
162
                             class="button-control button-control_light">
163
                             class="button-control button-control_light">

+ 5
- 2
modules/translation/translation.js 查看文件

98
         return i18n.lng();
98
         return i18n.lng();
99
     },
99
     },
100
     translateElement: function (selector, options) {
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
     generateTranslationHTML: function (key, options) {
105
     generateTranslationHTML: function (key, options) {
104
         var str = "<span data-i18n=\"" + key + "\"";
106
         var str = "<span data-i18n=\"" + key + "\"";
106
             str += " data-i18n-options='" + JSON.stringify(options) + "'";
108
             str += " data-i18n-options='" + JSON.stringify(options) + "'";
107
         }
109
         }
108
         str += ">";
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
         str += "</span>";
113
         str += "</span>";
111
         return str;
114
         return str;
112
 
115
 

正在加载...
取消
保存