Pārlūkot izejas kodu

Adds multi language support for message handlers.

master
hristoterezov 10 gadus atpakaļ
vecāks
revīzija
74f078f166

+ 1
- 1
index.html Parādīt failu

19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21
     <script src="interface_config.js?v=5"></script>
21
     <script src="interface_config.js?v=5"></script>
22
-    <script src="libs/app.bundle.js?v=13"></script>
22
+    <script src="libs/app.bundle.js?v=14"></script>
23
 
23
 
24
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
24
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
25
     <link rel="stylesheet" href="css/font.css?v=6"/>
25
     <link rel="stylesheet" href="css/font.css?v=6"/>

+ 55
- 7
lang/main.json Parādīt failu

118
         "grantedTo": "Moderator rights granted to __to__!",
118
         "grantedTo": "Moderator rights granted to __to__!",
119
         "grantedToUnknown": "Moderator rights granted to $t(somebody)!"
119
         "grantedToUnknown": "Moderator rights granted to $t(somebody)!"
120
 
120
 
121
+    },
122
+    "dialog": {
123
+        "kickMessage": "Ouch! You have been kicked out of the meet!",
124
+        "popupError": "Your browser is blocking popup windows from this site. Please enable popups in your browser security settings and try again.",
125
+        "passwordError": "This conversation is currently protected by a password. Only the owner of the conference could set a password.",
126
+        "passwordError2": "This conversation isn't currently protected by a password. Only the owner of the conference could set a password.",
127
+        "joinError": "Oops ! We couldn`t join the conference. There might be some problem with security configuration. Please contact service administrator.",
128
+        "connectError": "Oops! Something went wrong and we couldn`t connect to the conference.",
129
+        "error": "Error",
130
+        "detectext": "Error when trying to detect desktopsharing extension.",
131
+        "failtoinstall": "Failed to install desktop sharing extension",
132
+        "failedpermissions": "Failed to obtain permissions to use the local microphone and/or camera.",
133
+        "bridgeUnavailable": "Jitsi Videobridge is currently unavailable. Please try again later!",
134
+        "lockTitle": "Lock failed",
135
+        "lockMessage": "Failed to lock conference.",
136
+        "warning": "Warning",
137
+        "passwordNotSupported": "Room passwords are currently not supported.",
138
+        "sorry": "Sorry",
139
+        "internalError": "Internal application error[setRemoteDescription]",
140
+        "unableToSwitch": "Unable to switch video stream.",
141
+        "SLDFailure": "Oops! Something went wrong and we failed to mute! (SLD Failure)",
142
+        "SRDFailure": "Oops! Something went wrong and we failed to stop video!(SRD Failure)",
143
+        "oops": "Oops!",
144
+        "defaultError": "There was some kind of error",
145
+        "passwordRequired": "Password required",
146
+        "Ok": "Ok",
147
+        "removePreziTitle": "Remove Prezi",
148
+        "removePreziMsg": "Are you sure you would like to remove your Prezi?",
149
+        "sharePreziTitle": "Share a Prezi",
150
+        "sharePreziMsg": "Another participant is already sharing a Prezi.This conference allows only one Prezi at a time.",
151
+        "Remove": "Remove",
152
+        "Stop": "Stop",
153
+        "AuthMsg": "Authentication is required to create room:<br/><b>__room__ </b></br> You can either authenticate to create the room or just wait for someone else to do so.",
154
+        "Authenticate": "Authenticate",
155
+        "Cancel": "Cancel",
156
+        "sessTerminated": "Session Terminated",
157
+        "hungUp": "You hung up the call",
158
+        "joinAgain": "Join again",
159
+        "Share": "Share",
160
+        "preziLinkError": "Please provide a correct prezi link.",
161
+        "Save": "Save",
162
+        "recordingToken": "Enter recording token",
163
+        "Dial": "Dial",
164
+        "sipMsg": "Enter SIP number",
165
+        "passwordCheck": "Are you sure you would like to remove your password?",
166
+        "Remove": "Remove",
167
+        "passwordMsg": "Set a password to lock your room",
168
+        "Invite": "Invite",
169
+        "shareLink": "Share this link with everyone you want to invite",
170
+        "settings1": "Configure your conference",
171
+        "settings2": "Participants join muted",
172
+        "settings3": "Require nicknames<br/><br/>Set a password to lock your room:",
173
+        "yourPassword": "your password",
174
+        "Back": "Back"
121
     }
175
     }
122
-
123
-
124
-
125
-
126
-
127
-
128
-}
176
+}

+ 17722
- 17595
libs/app.bundle.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 6
- 4
modules/RTC/RTCUtils.js Parādīt failu

315
                 return self.successCallback(stream);
315
                 return self.successCallback(stream);
316
             },
316
             },
317
             function (error) {
317
             function (error) {
318
-                console.error('failed to obtain audio/video stream - stop', error);
319
-                APP.UI.messageHandler.showError("Error",
320
-                        "Failed to obtain permissions to use the local microphone" +
321
-                        "and/or camera.");
318
+                console.error('failed to obtain audio/video stream - stop',
319
+                    error);
320
+                APP.UI.messageHandler.showError("dialog.error", "Error",
321
+                    "dialog.failedpermissions",
322
+                    "Failed to obtain permissions to use the local microphone " +
323
+                    "and/or camera.");
322
             }
324
             }
323
         );
325
         );
324
     }
326
     }

+ 21
- 13
modules/UI/UI.js Parādīt failu

136
         VideoLayout.onStatsStop);
136
         VideoLayout.onStatsStop);
137
     APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
137
     APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
138
     APP.xmpp.addListener(XMPPEvents.KICKED, function () {
138
     APP.xmpp.addListener(XMPPEvents.KICKED, function () {
139
-        messageHandler.openMessageDialog("Session Terminated",
140
-            "Ouch! You have been kicked out of the meet!");
139
+        messageHandler.openMessageDialog("dialog.sessTerminated", "Session Terminated",
140
+            "dialog.kickMessage", "Ouch! You have been kicked out of the meet!");
141
     });
141
     });
142
     APP.xmpp.addListener(XMPPEvents.BRIDGE_DOWN, function () {
142
     APP.xmpp.addListener(XMPPEvents.BRIDGE_DOWN, function () {
143
-        messageHandler.showError("Error",
143
+        messageHandler.showError("dialog.error","Error",
144
+            "dialog.bridgeUnavailable",
144
             "Jitsi Videobridge is currently unavailable. Please try again later!");
145
             "Jitsi Videobridge is currently unavailable. Please try again later!");
145
     });
146
     });
146
     APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) {
147
     APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) {
442
 function onPasswordReqiured(callback) {
443
 function onPasswordReqiured(callback) {
443
     // password is required
444
     // password is required
444
     Toolbar.lockLockButton();
445
     Toolbar.lockLockButton();
446
+    var message = '<h2 data-i18n="dialog.passwordRequired">';
447
+    message += APP.translation.translateString(
448
+        "dialog.passwordRequired", null, "Password required");
449
+    message += '</h2>' +
450
+        '<input id="lockKey" type="text" placeholder="password" autofocus>';
445
 
451
 
446
-    messageHandler.openTwoButtonDialog(null,
447
-            '<h2>Password required</h2>' +
448
-            '<input id="lockKey" type="text" placeholder="password" autofocus>',
452
+    messageHandler.openTwoButtonDialog(null, null, null, message,
449
         true,
453
         true,
450
-        "Ok",
454
+        "dialog.Ok",
451
         function (e, v, m, f) {},
455
         function (e, v, m, f) {},
452
         function (event) {
456
         function (event) {
453
             document.getElementById('lockKey').focus();
457
             document.getElementById('lockKey').focus();
605
 UI.showLoginPopup = function(callback)
609
 UI.showLoginPopup = function(callback)
606
 {
610
 {
607
     console.log('password is required');
611
     console.log('password is required');
608
-
609
-    UI.messageHandler.openTwoButtonDialog(null,
610
-            '<h2>Password required</h2>' +
611
-            '<input id="passwordrequired.username" type="text" placeholder="user@domain.net" autofocus>' +
612
-            '<input id="passwordrequired.password" type="password" placeholder="user password">',
612
+    var message = '<h2 data-i18n="dialog.passwordRequired">';
613
+    message += APP.translation.translateString(
614
+        "dialog.passwordRequired", null, "Password required");
615
+    message += '</h2>' +
616
+        '<input id="passwordrequired.username" type="text" ' +
617
+        'placeholder="user@domain.net" autofocus>' +
618
+        '<input id="passwordrequired.password" ' +
619
+        'type="password" placeholder="user password">';
620
+    UI.messageHandler.openTwoButtonDialog(null, null, null, message,
613
         true,
621
         true,
614
-        "Ok",
622
+        "dialog.Ok",
615
         function (e, v, m, f) {
623
         function (e, v, m, f) {
616
             if (v) {
624
             if (v) {
617
                 var username = document.getElementById('passwordrequired.username');
625
                 var username = document.getElementById('passwordrequired.username');

+ 16
- 7
modules/UI/authentication/Authentication.js Parādīt failu

16
         // extract room name from 'room@muc.server.net'
16
         // extract room name from 'room@muc.server.net'
17
         var room = roomName.substr(0, roomName.indexOf('@'));
17
         var room = roomName.substr(0, roomName.indexOf('@'));
18
 
18
 
19
+        var title = APP.translation.generateTranslatonHTML("dialog.Stop",
20
+            "Stop");
21
+        var defMsg = 'Authentication is required to create room:<br/><b>' +
22
+            room +
23
+            '</b></br> You can either authenticate to create the room or ' +
24
+            'just wait for someone else to do so.';
25
+        var msg = APP.translation.generateTranslatonHTML("dialog.AuthMsg",
26
+            defMsg, {room: room});
27
+        var button = APP.translation.generateTranslatonHTML(
28
+            "dialog.Authenticate", "Authenticate");
29
+        var buttons = {};
30
+        buttons.authenticate = {title: button, value: "authNow"};
31
+
19
         authDialog = APP.UI.messageHandler.openDialog(
32
         authDialog = APP.UI.messageHandler.openDialog(
20
-            'Stop',
21
-                'Authentication is required to create room:<br/><b>' + room +
22
-                '</b></br> You can either authenticate to create the room or ' +
23
-                'just wait for someone else to do so.',
33
+            title,
34
+            msg,
24
             true,
35
             true,
25
-            {
26
-                Authenticate: 'authNow'
27
-            },
36
+            buttons,
28
             function (onSubmitEvent, submitValue) {
37
             function (onSubmitEvent, submitValue) {
29
 
38
 
30
                 // Do not close the dialog yet
39
                 // Do not close the dialog yet

+ 26
- 9
modules/UI/prezi/Prezi.js Parādīt failu

33
     openPreziDialog: function() {
33
     openPreziDialog: function() {
34
         var myprezi = APP.xmpp.getPrezi();
34
         var myprezi = APP.xmpp.getPrezi();
35
         if (myprezi) {
35
         if (myprezi) {
36
-            messageHandler.openTwoButtonDialog("Remove Prezi",
36
+            messageHandler.openTwoButtonDialog("dialog.removePreziTitle",
37
+                "Remove Prezi", "dialog.removePreziMsg",
37
                 "Are you sure you would like to remove your Prezi?",
38
                 "Are you sure you would like to remove your Prezi?",
38
                 false,
39
                 false,
39
-                "Remove",
40
+                "dialog.Remove",
40
                 function(e,v,m,f) {
41
                 function(e,v,m,f) {
41
                     if(v) {
42
                     if(v) {
42
                         APP.xmpp.removePreziFromPresence();
43
                         APP.xmpp.removePreziFromPresence();
45
             );
46
             );
46
         }
47
         }
47
         else if (preziPlayer != null) {
48
         else if (preziPlayer != null) {
48
-            messageHandler.openTwoButtonDialog("Share a Prezi",
49
+            messageHandler.openTwoButtonDialog("dialog.sharePreziTitle",
50
+                "Share a Prezi", "dialog.sharePreziMsg",
49
                 "Another participant is already sharing a Prezi." +
51
                 "Another participant is already sharing a Prezi." +
50
                     "This conference allows only one Prezi at a time.",
52
                     "This conference allows only one Prezi at a time.",
51
                 false,
53
                 false,
52
-                "Ok",
54
+                "dialog.Ok",
53
                 function(e,v,m,f) {
55
                 function(e,v,m,f) {
54
                     $.prompt.close();
56
                     $.prompt.close();
55
                 }
57
                 }
56
             );
58
             );
57
         }
59
         }
58
         else {
60
         else {
61
+            var html = APP.translation.generateTranslatonHTML(
62
+                "dialog.sharePreziTitle", "Share a Prezi");
63
+            var cancelButton = APP.translation.generateTranslatonHTML(
64
+                "dialog.Cancel", "Cancel");
65
+            var shareButton = APP.translation.generateTranslatonHTML(
66
+                "dialog.Share", "Share");
67
+            var backButton = APP.translation.generateTranslatonHTML(
68
+                "dialog.Back", "Back");
69
+            var buttons = {};
70
+            var buttons1 = {};
71
+            buttons1.Cancel = buttons.Cancel = {title: cancelButton, value: false};
72
+            buttons.share = {title: shareButton, value: true};
73
+            buttons1.Back = {title: backButton, value: true};
74
+            var linkError = APP.translation.generateTranslatonHTML(
75
+                "dialog.preziLinkError", "Please provide a correct prezi link.")
59
             var openPreziState = {
76
             var openPreziState = {
60
                 state0: {
77
                 state0: {
61
-                    html:   '<h2>Share a Prezi</h2>' +
78
+                    html:   '<h2>' + html + '</h2>' +
62
                             '<input id="preziUrl" type="text" ' +
79
                             '<input id="preziUrl" type="text" ' +
63
                             'placeholder="e.g. ' +
80
                             'placeholder="e.g. ' +
64
                             'http://prezi.com/wz7vhjycl7e6/my-prezi" autofocus>',
81
                             'http://prezi.com/wz7vhjycl7e6/my-prezi" autofocus>',
65
                     persistent: false,
82
                     persistent: false,
66
-                    buttons: { "Share": true , "Cancel": false},
83
+                    buttons: buttons,
67
                     defaultButton: 1,
84
                     defaultButton: 1,
68
                     submit: function(e,v,m,f){
85
                     submit: function(e,v,m,f){
69
                         e.preventDefault();
86
                         e.preventDefault();
102
                     }
119
                     }
103
                 },
120
                 },
104
                 state1: {
121
                 state1: {
105
-                    html:   '<h2>Share a Prezi</h2>' +
106
-                            'Please provide a correct prezi link.',
122
+                    html:   '<h2>' + html + '</h2>' +
123
+                            linkError,
107
                     persistent: false,
124
                     persistent: false,
108
-                    buttons: { "Back": true, "Cancel": false },
125
+                    buttons: buttons1,
109
                     defaultButton: 1,
126
                     defaultButton: 1,
110
                     submit:function(e,v,m,f) {
127
                     submit:function(e,v,m,f) {
111
                         e.preventDefault();
128
                         e.preventDefault();

+ 64
- 31
modules/UI/toolbars/Toolbar.js Parādīt failu

95
 
95
 
96
     }
96
     }
97
 
97
 
98
+    var title = APP.translation.generateTranslatonHTML(
99
+        "dialog.sessTerminated", "Session Terminated");
100
+    var msg = APP.translation.generateTranslatonHTML(
101
+        "dialog.hungUp","You hung up the call");
102
+    var button = APP.translation.generateTranslatonHTML(
103
+        "dialog.joinAgain", "Join again");
104
+    var buttons = {};
105
+    buttons.joinAgain = {title: button, value: true};
106
+
98
     UI.messageHandler.openDialog(
107
     UI.messageHandler.openDialog(
99
-        "Session Terminated",
100
-        "You hung up the call",
108
+        title,
109
+        msg,
101
         true,
110
         true,
102
-        { "Join again": true },
111
+        buttons,
103
         function(event, value, message, formVals)
112
         function(event, value, message, formVals)
104
         {
113
         {
105
             window.location.reload();
114
             window.location.reload();
114
 
123
 
115
 function toggleRecording() {
124
 function toggleRecording() {
116
     APP.xmpp.toggleRecording(function (callback) {
125
     APP.xmpp.toggleRecording(function (callback) {
117
-        APP.UI.messageHandler.openTwoButtonDialog(null,
118
-                '<h2>Enter recording token</h2>' +
126
+        var msg = APP.translation.generateTranslatonHTML(
127
+            "dialog.recordingToken", "Enter recording token");
128
+        APP.UI.messageHandler.openTwoButtonDialog(null, null, null,
129
+                '<h2>' + msg + '</h2>' +
119
                 '<input id="recordingToken" type="text" ' +
130
                 '<input id="recordingToken" type="text" ' +
120
                 'placeholder="token" autofocus>',
131
                 'placeholder="token" autofocus>',
121
             false,
132
             false,
122
-            "Save",
133
+            "dialog.Save",
123
             function (e, v, m, f) {
134
             function (e, v, m, f) {
124
                 if (v) {
135
                 if (v) {
125
                     var token = document.getElementById('recordingToken');
136
                     var token = document.getElementById('recordingToken');
160
         }
171
         }
161
     }, function (err) {
172
     }, function (err) {
162
         console.warn('setting password failed', err);
173
         console.warn('setting password failed', err);
163
-        messageHandler.showError('Lock failed',
174
+        messageHandler.showError("dialog.lockTitle", 'Lock failed',
175
+            "dialog.lockMessage",
164
             'Failed to lock conference.',
176
             'Failed to lock conference.',
165
             err);
177
             err);
166
         Toolbar.setSharedKey('');
178
         Toolbar.setSharedKey('');
167
     }, function () {
179
     }, function () {
168
         console.warn('room passwords not supported');
180
         console.warn('room passwords not supported');
169
-        messageHandler.showError('Warning',
181
+        messageHandler.showError("dialog.warning", 'Warning',
182
+            "dialog.passwordNotSupported",
170
             'Room passwords are currently not supported.');
183
             'Room passwords are currently not supported.');
171
         Toolbar.setSharedKey('');
184
         Toolbar.setSharedKey('');
172
     });
185
     });
218
     var defaultNumber
231
     var defaultNumber
219
         = config.defaultSipNumber ? config.defaultSipNumber : '';
232
         = config.defaultSipNumber ? config.defaultSipNumber : '';
220
 
233
 
221
-    messageHandler.openTwoButtonDialog(null,
222
-        '<h2>Enter SIP number</h2>' +
234
+    var sipMsg = APP.translation.generateTranslatonHTML(
235
+        "dialog.sipMsg", "Enter SIP number");
236
+    messageHandler.openTwoButtonDialog(null, null, null,
237
+        '<h2>' + sipMsg + '</h2>' +
223
         '<input id="sipNumber" type="text"' +
238
         '<input id="sipNumber" type="text"' +
224
         ' value="' + defaultNumber + '" autofocus>',
239
         ' value="' + defaultNumber + '" autofocus>',
225
         false,
240
         false,
226
-        "Dial",
241
+        "dialog.Dial",
227
         function (e, v, m, f) {
242
         function (e, v, m, f) {
228
             if (v) {
243
             if (v) {
229
                 var numberInput = document.getElementById('sipNumber');
244
                 var numberInput = document.getElementById('sipNumber');
302
                     }, url);
317
                     }, url);
303
                 if (!authenticationWindow) {
318
                 if (!authenticationWindow) {
304
                     messageHandler.openMessageDialog(
319
                     messageHandler.openMessageDialog(
305
-                        null, "Your browser is blocking popup windows from this site." +
320
+                        null, null, "dialog.popupError",
321
+                        "Your browser is blocking popup windows from this site." +
306
                         " Please enable popups in your browser security settings" +
322
                         " Please enable popups in your browser security settings" +
307
                         " and try again.");
323
                         " and try again.");
308
                 }
324
                 }
342
         // Only the focus is able to set a shared key.
358
         // Only the focus is able to set a shared key.
343
         if (!APP.xmpp.isModerator()) {
359
         if (!APP.xmpp.isModerator()) {
344
             if (sharedKey) {
360
             if (sharedKey) {
345
-                messageHandler.openMessageDialog(null,
361
+                messageHandler.openMessageDialog(null, null,
362
+                    "dialog.passwordError",
346
                         "This conversation is currently protected by" +
363
                         "This conversation is currently protected by" +
347
                         " a password. Only the owner of the conference" +
364
                         " a password. Only the owner of the conference" +
348
                         " could set a password.",
365
                         " could set a password.",
349
                     false,
366
                     false,
350
                     "Password");
367
                     "Password");
351
             } else {
368
             } else {
352
-                messageHandler.openMessageDialog(null,
369
+                messageHandler.openMessageDialog(null, null, "dialog.passwordError2",
353
                     "This conversation isn't currently protected by" +
370
                     "This conversation isn't currently protected by" +
354
                         " a password. Only the owner of the conference" +
371
                         " a password. Only the owner of the conference" +
355
                         " could set a password.",
372
                         " could set a password.",
358
             }
375
             }
359
         } else {
376
         } else {
360
             if (sharedKey) {
377
             if (sharedKey) {
361
-                messageHandler.openTwoButtonDialog(null,
378
+                messageHandler.openTwoButtonDialog(null, null,
379
+                    "dialog.passwordCheck",
362
                     "Are you sure you would like to remove your password?",
380
                     "Are you sure you would like to remove your password?",
363
                     false,
381
                     false,
364
-                    "Remove",
382
+                    "dialog.Remove",
365
                     function (e, v) {
383
                     function (e, v) {
366
                         if (v) {
384
                         if (v) {
367
                             Toolbar.setSharedKey('');
385
                             Toolbar.setSharedKey('');
369
                         }
387
                         }
370
                     });
388
                     });
371
             } else {
389
             } else {
372
-                messageHandler.openTwoButtonDialog(null,
373
-                    '<h2>Set a password to lock your room</h2>' +
390
+                var msg = APP.translation.generateTranslatonHTML(
391
+                    "dialog.passwordMsg", "Set a password to lock your room");
392
+                var yourPassword = APP.translation.translateString(
393
+                    "dialog.yourPassword", null, "your password");
394
+                messageHandler.openTwoButtonDialog(null, null, null,
395
+                    '<h2>' + msg + '</h2>' +
374
                         '<input id="lockKey" type="text"' +
396
                         '<input id="lockKey" type="text"' +
375
-                        'placeholder="your password" autofocus>',
397
+                        'placeholder="' + yourPassword + '" autofocus>',
376
                     false,
398
                     false,
377
-                    "Save",
399
+                    "dialog.Save",
378
                     function (e, v) {
400
                     function (e, v) {
379
                         if (v) {
401
                         if (v) {
380
                             var lockKey = document.getElementById('lockKey');
402
                             var lockKey = document.getElementById('lockKey');
403
         } else {
425
         } else {
404
             inviteLink = encodeURI(roomUrl);
426
             inviteLink = encodeURI(roomUrl);
405
         }
427
         }
406
-        messageHandler.openTwoButtonDialog(
407
-            "Share this link with everyone you want to invite",
428
+        messageHandler.openTwoButtonDialog("dialog.shareLink",
429
+            "Share this link with everyone you want to invite", null,
408
             '<input id="inviteLinkRef" type="text" value="' +
430
             '<input id="inviteLinkRef" type="text" value="' +
409
                 inviteLink + '" onclick="this.select();" readonly>',
431
                 inviteLink + '" onclick="this.select();" readonly>',
410
             false,
432
             false,
411
-            "Invite",
433
+            "dialog.Invite",
412
             function (e, v) {
434
             function (e, v) {
413
                 if (v) {
435
                 if (v) {
414
                     if (roomUrl) {
436
                     if (roomUrl) {
431
      * Opens the settings dialog.
453
      * Opens the settings dialog.
432
      */
454
      */
433
     my.openSettingsDialog = function () {
455
     my.openSettingsDialog = function () {
434
-        messageHandler.openTwoButtonDialog(
435
-            '<h2>Configure your conference</h2>' +
456
+        var settings1 = APP.translation.generateTranslatonHTML(
457
+            "dialog.settings1", "Configure your conference");
458
+        var settings2 = APP.translation.generateTranslatonHTML(
459
+            "dialog.settings2", "Participants join muted");
460
+        var settings3 = APP.translation.generateTranslatonHTML(
461
+            "dialog.settings3", "Require nicknames<br/><br/>" +
462
+                "Set a password to lock your room:");
463
+
464
+        var yourPassword = APP.translation.translateString(
465
+            "dialog.yourPassword", null, "your password");
466
+
467
+        messageHandler.openTwoButtonDialog(null,
468
+            '<h2>' + settings1 + '</h2>' +
436
                 '<input type="checkbox" id="initMuted">' +
469
                 '<input type="checkbox" id="initMuted">' +
437
-                'Participants join muted<br/>' +
470
+                settings2 + '<br/>' +
438
                 '<input type="checkbox" id="requireNicknames">' +
471
                 '<input type="checkbox" id="requireNicknames">' +
439
-                'Require nicknames<br/><br/>' +
440
-                'Set a password to lock your room:' +
441
-                '<input id="lockKey" type="text" placeholder="your password"' +
442
-                'autofocus>',
472
+                 settings3 +
473
+                '<input id="lockKey" type="text" placeholder="' + yourPassword +
474
+                '" data-i18n="[placeholder]dialog.yourPassword" autofocus>',
475
+            null,
443
             null,
476
             null,
444
             false,
477
             false,
445
-            "Save",
478
+            "dialog.Save",
446
             function () {
479
             function () {
447
                 document.getElementById('lockKey').focus();
480
                 document.getElementById('lockKey').focus();
448
             },
481
             },

+ 45
- 16
modules/UI/util/MessageHandler.js Parādīt failu

7
      * @param titleString the title of the message
7
      * @param titleString the title of the message
8
      * @param messageString the text of the message
8
      * @param messageString the text of the message
9
      */
9
      */
10
-    my.openMessageDialog = function(titleString, messageString) {
11
-        $.prompt(messageString,
10
+    my.openMessageDialog = function(titleKey, titleString,
11
+                                    messageKey, messageString) {
12
+        var title = null;
13
+        if(titleKey)
14
+        {
15
+            title = APP.translation.generateTranslatonHTML(titleKey,
16
+                titleString);
17
+        }
18
+        var message = APP.translation.generateTranslatonHTML(messageKey,
19
+            messageString);
20
+        $.prompt(message,
12
             {
21
             {
13
-                title: titleString,
22
+                title: title,
14
                 persistent: false
23
                 persistent: false
15
             }
24
             }
16
         );
25
         );
27
      * @param loadedFunction function to be called after the prompt is fully loaded
36
      * @param loadedFunction function to be called after the prompt is fully loaded
28
      * @param closeFunction function to be called after the prompt is closed
37
      * @param closeFunction function to be called after the prompt is closed
29
      */
38
      */
30
-    my.openTwoButtonDialog = function(titleString, msgString, persistent, leftButton,
31
-                                      submitFunction, loadedFunction, closeFunction) {
39
+    my.openTwoButtonDialog = function(titleKey, titleString, msgKey, msgString,
40
+        persistent, leftButtonKey, submitFunction, loadedFunction,
41
+        closeFunction)
42
+    {
43
+        var leftButton = APP.translation.generateTranslatonHTML(leftButtonKey);
32
         var buttons = {};
44
         var buttons = {};
33
-        buttons[leftButton] = true;
34
-        buttons.Cancel = false;
35
-        $.prompt(msgString, {
36
-            title: titleString,
45
+        buttons.leftButton = {title: leftButton, value: true};
46
+        var cancelButton = APP.translation.generateTranslatonHTML("dialog.Cancel",
47
+            "Cancel");
48
+        buttons.Cancel = {title: cancelButton, value: false};
49
+        var message = msgString, title = titleString;
50
+        if(titleKey)
51
+        {
52
+            title = APP.translation.generateTranslatonHTML(titleKey, titleString);
53
+        }
54
+        if(msgKey) {
55
+            message = APP.translation.generateTranslatonHTML(msgKey, msgString);
56
+        }
57
+        $.prompt(message, {
58
+            title: title,
37
             persistent: false,
59
             persistent: false,
38
             buttons: buttons,
60
             buttons: buttons,
39
             defaultButton: 1,
61
             defaultButton: 1,
130
      * @param msgString the text of the message
152
      * @param msgString the text of the message
131
      * @param error the error that is being reported
153
      * @param error the error that is being reported
132
      */
154
      */
133
-    my.openReportDialog = function(titleString, msgString, error) {
134
-        my.openMessageDialog(titleString, msgString);
155
+    my.openReportDialog = function(titleKey, titleString, msgKey,
156
+                                   msgString, error) {
157
+        my.openMessageDialog(titleKey, titleString, msgKey, msgString);
135
         console.log(error);
158
         console.log(error);
136
         //FIXME send the error to the server
159
         //FIXME send the error to the server
137
     };
160
     };
141
      * @param title the title of the message
164
      * @param title the title of the message
142
      * @param message the text of the messafe
165
      * @param message the text of the messafe
143
      */
166
      */
144
-    my.showError = function(title, message) {
145
-        if(!(title || message)) {
146
-            title = title || "Oops!";
147
-            message = message || "There was some kind of error";
167
+    my.showError = function(titleKey, title, msgKey, message) {
168
+
169
+        if(!titleKey) {
170
+            title = "Oops!";
171
+            titleKey = "dialog.oops";
172
+        }
173
+        if(!msgKey)
174
+        {
175
+            message = "There was some kind of error";
176
+            msgKey = "dialog.defaultError";
148
         }
177
         }
149
-        messageHandler.openMessageDialog(title, message);
178
+        messageHandler.openMessageDialog(titleKey, title, msgKey, message);
150
     };
179
     };
151
 
180
 
152
     my.notify = function(displayName, displayNameKey, displayNameDefault,
181
     my.notify = function(displayName, displayNameKey, displayNameDefault,

+ 4
- 2
modules/desktopsharing/desktopsharing.js Parādīt failu

92
     catch (e)
92
     catch (e)
93
     {
93
     {
94
         console.error("Failed to parse extension version", e);
94
         console.error("Failed to parse extension version", e);
95
-        APP.UI.messageHandler.showError('Error',
95
+        APP.UI.messageHandler.showError("dialog.error", 'Error',
96
+            "dialod.detectext",
96
             'Error when trying to detect desktopsharing extension.');
97
             'Error when trying to detect desktopsharing extension.');
97
         return true;
98
         return true;
98
     }
99
     }
174
                     function (arg) {
175
                     function (arg) {
175
                         console.log("Failed to install the extension", arg);
176
                         console.log("Failed to install the extension", arg);
176
                         failCallback(arg);
177
                         failCallback(arg);
177
-                        APP.UI.messageHandler.showError('Error',
178
+                        APP.UI.messageHandler.showError("dialog.error", 'Error',
179
+                            "dialog.failtoinstall",
178
                             'Failed to install desktop sharing extension');
180
                             'Failed to install desktop sharing extension');
179
                     }
181
                     }
180
                 );
182
                 );

+ 22
- 3
modules/translation/translation.js Parādīt failu

14
     detectLngQS: "lang",
14
     detectLngQS: "lang",
15
     useCookie: false,
15
     useCookie: false,
16
     fallbackLng: DEFAULT_LANG,
16
     fallbackLng: DEFAULT_LANG,
17
+    shortcutFunction: 'defaultValue',
17
     load: "unspecific",
18
     load: "unspecific",
18
     resGetPath: 'lang/__ns__-__lng__.json',
19
     resGetPath: 'lang/__ns__-__lng__.json',
19
     ns: {
20
     ns: {
82
             options.lng = lang;
83
             options.lng = lang;
83
         i18n.init(options, initCompleted);
84
         i18n.init(options, initCompleted);
84
     },
85
     },
85
-    translateString: function (key, cb, defaultValue) {
86
+    translateString: function (key, cb, options) {
86
         if(!cb)
87
         if(!cb)
87
-            return i18n.t(key, defaultValue);
88
+            return i18n.t(key, options);
88
 
89
 
89
         if(initialized)
90
         if(initialized)
90
         {
91
         {
91
-            cb(i18n.t(key, defaultValue));
92
+            cb(i18n.t(key, options));
92
         }
93
         }
93
         else
94
         else
94
         {
95
         {
106
     },
107
     },
107
     translateElement: function (selector) {
108
     translateElement: function (selector) {
108
         selector.i18n();
109
         selector.i18n();
110
+    },
111
+    generateTranslatonHTML: function (key, defaultString, options) {
112
+        var str = "<span data-i18n=\"" + key + "\"";
113
+        if(options)
114
+        {
115
+            str += " data-i18n-options=\"" + JSON.stringify(options) + "\"";
116
+        }
117
+        str += ">";
118
+        if(!options)
119
+            options = {};
120
+        if(defaultString)
121
+        {
122
+            options.defaultValue = defaultString;
123
+        }
124
+        str += this.translateString(key, null, options);
125
+        str += "</span>";
126
+        return str;
127
+
109
     }
128
     }
110
 };
129
 };

+ 2
- 1
modules/xmpp/JingleSession.js Parādīt failu

1226
 {
1226
 {
1227
     this.service.sessionTerminated = true;
1227
     this.service.sessionTerminated = true;
1228
     this.connection.emuc.doLeave();
1228
     this.connection.emuc.doLeave();
1229
-    APP.UI.messageHandler.showError(  "Sorry",
1229
+    APP.UI.messageHandler.showError("dialog.sorry", "Sorry",
1230
+        "dialog.internalError",
1230
         "Internal application error[setRemoteDescription]");
1231
         "Internal application error[setRemoteDescription]");
1231
 }
1232
 }
1232
 
1233
 

+ 10
- 5
modules/xmpp/strophe.emuc.js Parādīt failu

271
                     // We're either missing Jicofo/Prosody config for anonymous
271
                     // We're either missing Jicofo/Prosody config for anonymous
272
                     // domains or something is wrong.
272
                     // domains or something is wrong.
273
 //                    XMPP.promptLogin();
273
 //                    XMPP.promptLogin();
274
-                    APP.UI.messageHandler.openReportDialog(null,
274
+                    APP.UI.messageHandler.openReportDialog(null, null,
275
+                        "dialog.joinError",
275
                         'Oops ! We couldn`t join the conference.' +
276
                         'Oops ! We couldn`t join the conference.' +
276
                         ' There might be some problem with security' +
277
                         ' There might be some problem with security' +
277
                         ' configuration. Please contact service' +
278
                         ' configuration. Please contact service' +
278
                         ' administrator.', pres);
279
                         ' administrator.', pres);
279
                 } else {
280
                 } else {
280
                     console.warn('onPresError ', pres);
281
                     console.warn('onPresError ', pres);
281
-                    APP.UI.messageHandler.openReportDialog(null,
282
-                        'Oops! Something went wrong and we couldn`t connect to the conference.',
282
+                    APP.UI.messageHandler.openReportDialog(null, null,
283
+                        "dialog.connectError",
284
+                        'Oops! Something went wrong and we couldn`t ' +
285
+                            'connect to the conference.',
283
                         pres);
286
                         pres);
284
                 }
287
                 }
285
             } else {
288
             } else {
286
                 console.warn('onPresError ', pres);
289
                 console.warn('onPresError ', pres);
287
-                APP.UI.messageHandler.openReportDialog(null,
288
-                    'Oops! Something went wrong and we couldn`t connect to the conference.',
290
+                APP.UI.messageHandler.openReportDialog(null, null,
291
+                    "dialog.connectError",
292
+                    'Oops! Something went wrong and we couldn`t ' +
293
+                        'connect to the conference.',
289
                     pres);
294
                     pres);
290
             }
295
             }
291
             return true;
296
             return true;

+ 10
- 8
modules/xmpp/xmpp.js Parādīt failu

252
         } else {
252
         } else {
253
             // We are done immediately
253
             // We are done immediately
254
             console.error("No conference handler");
254
             console.error("No conference handler");
255
-            APP.UI.messageHandler.showError('Error',
256
-                'Unable to switch video stream.');
255
+            APP.UI.messageHandler.showError("dialog.error", 'Error',
256
+                "dialog.unableToSwitch", 'Unable to switch video stream.');
257
             callback();
257
             callback();
258
         }
258
         }
259
     },
259
     },
314
                             },
314
                             },
315
                             function (error) {
315
                             function (error) {
316
                                 console.log('mute SLD error');
316
                                 console.log('mute SLD error');
317
-                                APP.UI.messageHandler.showError('Error',
318
-                                        'Oops! Something went wrong and we failed to ' +
319
-                                        'mute! (SLD Failure)');
317
+                                APP.UI.messageHandler.showError("dialog.error",
318
+                                    'Error', "dialog.SLDFailure",
319
+                                    'Oops! Something went wrong and we failed to ' +
320
+                                    'mute! (SLD Failure)');
320
                             }
321
                             }
321
                         );
322
                         );
322
                     },
323
                     },
328
             },
329
             },
329
             function (error) {
330
             function (error) {
330
                 console.log('muteVideo SRD error');
331
                 console.log('muteVideo SRD error');
331
-                APP.UI.messageHandler.showError('Error',
332
-                        'Oops! Something went wrong and we failed to stop video!' +
333
-                        '(SRD Failure)');
332
+                APP.UI.messageHandler.showError("dialog.error", 'Error',
333
+                    "dialog.SRDFailure",
334
+                    'Oops! Something went wrong and we failed to stop video!' +
335
+                    '(SRD Failure)');
334
 
336
 
335
             }
337
             }
336
         );
338
         );

Notiek ielāde…
Atcelt
Saglabāt