Bläddra i källkod

Adds multi language support for message handlers.

j8
hristoterezov 10 år sedan
förälder
incheckning
74f078f166

+ 1
- 1
index.html Visa fil

@@ -19,7 +19,7 @@
19 19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20 20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21 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 24
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
25 25
     <link rel="stylesheet" href="css/font.css?v=6"/>

+ 55
- 7
lang/main.json Visa fil

@@ -118,11 +118,59 @@
118 118
         "grantedTo": "Moderator rights granted to __to__!",
119 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
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 6
- 4
modules/RTC/RTCUtils.js Visa fil

@@ -315,10 +315,12 @@ RTCUtils.prototype.errorCallback = function (error) {
315 315
                 return self.successCallback(stream);
316 316
             },
317 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 Visa fil

@@ -136,11 +136,12 @@ function registerListeners() {
136 136
         VideoLayout.onStatsStop);
137 137
     APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
138 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 142
     APP.xmpp.addListener(XMPPEvents.BRIDGE_DOWN, function () {
143
-        messageHandler.showError("Error",
143
+        messageHandler.showError("dialog.error","Error",
144
+            "dialog.bridgeUnavailable",
144 145
             "Jitsi Videobridge is currently unavailable. Please try again later!");
145 146
     });
146 147
     APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) {
@@ -442,12 +443,15 @@ function onModeratorStatusChanged(isModerator) {
442 443
 function onPasswordReqiured(callback) {
443 444
     // password is required
444 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 453
         true,
450
-        "Ok",
454
+        "dialog.Ok",
451 455
         function (e, v, m, f) {},
452 456
         function (event) {
453 457
             document.getElementById('lockKey').focus();
@@ -605,13 +609,17 @@ UI.disableConnect = function () {
605 609
 UI.showLoginPopup = function(callback)
606 610
 {
607 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 621
         true,
614
-        "Ok",
622
+        "dialog.Ok",
615 623
         function (e, v, m, f) {
616 624
             if (v) {
617 625
                 var username = document.getElementById('passwordrequired.username');

+ 16
- 7
modules/UI/authentication/Authentication.js Visa fil

@@ -16,15 +16,24 @@ var Authentication = {
16 16
         // extract room name from 'room@muc.server.net'
17 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 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 35
             true,
25
-            {
26
-                Authenticate: 'authNow'
27
-            },
36
+            buttons,
28 37
             function (onSubmitEvent, submitValue) {
29 38
 
30 39
                 // Do not close the dialog yet

+ 26
- 9
modules/UI/prezi/Prezi.js Visa fil

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

+ 64
- 31
modules/UI/toolbars/Toolbar.js Visa fil

@@ -95,11 +95,20 @@ function hangup() {
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 107
     UI.messageHandler.openDialog(
99
-        "Session Terminated",
100
-        "You hung up the call",
108
+        title,
109
+        msg,
101 110
         true,
102
-        { "Join again": true },
111
+        buttons,
103 112
         function(event, value, message, formVals)
104 113
         {
105 114
             window.location.reload();
@@ -114,12 +123,14 @@ function hangup() {
114 123
 
115 124
 function toggleRecording() {
116 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 130
                 '<input id="recordingToken" type="text" ' +
120 131
                 'placeholder="token" autofocus>',
121 132
             false,
122
-            "Save",
133
+            "dialog.Save",
123 134
             function (e, v, m, f) {
124 135
                 if (v) {
125 136
                     var token = document.getElementById('recordingToken');
@@ -160,13 +171,15 @@ function lockRoom(lock) {
160 171
         }
161 172
     }, function (err) {
162 173
         console.warn('setting password failed', err);
163
-        messageHandler.showError('Lock failed',
174
+        messageHandler.showError("dialog.lockTitle", 'Lock failed',
175
+            "dialog.lockMessage",
164 176
             'Failed to lock conference.',
165 177
             err);
166 178
         Toolbar.setSharedKey('');
167 179
     }, function () {
168 180
         console.warn('room passwords not supported');
169
-        messageHandler.showError('Warning',
181
+        messageHandler.showError("dialog.warning", 'Warning',
182
+            "dialog.passwordNotSupported",
170 183
             'Room passwords are currently not supported.');
171 184
         Toolbar.setSharedKey('');
172 185
     });
@@ -218,12 +231,14 @@ function callSipButtonClicked()
218 231
     var defaultNumber
219 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 238
         '<input id="sipNumber" type="text"' +
224 239
         ' value="' + defaultNumber + '" autofocus>',
225 240
         false,
226
-        "Dial",
241
+        "dialog.Dial",
227 242
         function (e, v, m, f) {
228 243
             if (v) {
229 244
                 var numberInput = document.getElementById('sipNumber');
@@ -302,7 +317,8 @@ var Toolbar = (function (my) {
302 317
                     }, url);
303 318
                 if (!authenticationWindow) {
304 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 322
                         " Please enable popups in your browser security settings" +
307 323
                         " and try again.");
308 324
                 }
@@ -342,14 +358,15 @@ var Toolbar = (function (my) {
342 358
         // Only the focus is able to set a shared key.
343 359
         if (!APP.xmpp.isModerator()) {
344 360
             if (sharedKey) {
345
-                messageHandler.openMessageDialog(null,
361
+                messageHandler.openMessageDialog(null, null,
362
+                    "dialog.passwordError",
346 363
                         "This conversation is currently protected by" +
347 364
                         " a password. Only the owner of the conference" +
348 365
                         " could set a password.",
349 366
                     false,
350 367
                     "Password");
351 368
             } else {
352
-                messageHandler.openMessageDialog(null,
369
+                messageHandler.openMessageDialog(null, null, "dialog.passwordError2",
353 370
                     "This conversation isn't currently protected by" +
354 371
                         " a password. Only the owner of the conference" +
355 372
                         " could set a password.",
@@ -358,10 +375,11 @@ var Toolbar = (function (my) {
358 375
             }
359 376
         } else {
360 377
             if (sharedKey) {
361
-                messageHandler.openTwoButtonDialog(null,
378
+                messageHandler.openTwoButtonDialog(null, null,
379
+                    "dialog.passwordCheck",
362 380
                     "Are you sure you would like to remove your password?",
363 381
                     false,
364
-                    "Remove",
382
+                    "dialog.Remove",
365 383
                     function (e, v) {
366 384
                         if (v) {
367 385
                             Toolbar.setSharedKey('');
@@ -369,12 +387,16 @@ var Toolbar = (function (my) {
369 387
                         }
370 388
                     });
371 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 396
                         '<input id="lockKey" type="text"' +
375
-                        'placeholder="your password" autofocus>',
397
+                        'placeholder="' + yourPassword + '" autofocus>',
376 398
                     false,
377
-                    "Save",
399
+                    "dialog.Save",
378 400
                     function (e, v) {
379 401
                         if (v) {
380 402
                             var lockKey = document.getElementById('lockKey');
@@ -403,12 +425,12 @@ var Toolbar = (function (my) {
403 425
         } else {
404 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 430
             '<input id="inviteLinkRef" type="text" value="' +
409 431
                 inviteLink + '" onclick="this.select();" readonly>',
410 432
             false,
411
-            "Invite",
433
+            "dialog.Invite",
412 434
             function (e, v) {
413 435
                 if (v) {
414 436
                     if (roomUrl) {
@@ -431,18 +453,29 @@ var Toolbar = (function (my) {
431 453
      * Opens the settings dialog.
432 454
      */
433 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 469
                 '<input type="checkbox" id="initMuted">' +
437
-                'Participants join muted<br/>' +
470
+                settings2 + '<br/>' +
438 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 476
             null,
444 477
             false,
445
-            "Save",
478
+            "dialog.Save",
446 479
             function () {
447 480
                 document.getElementById('lockKey').focus();
448 481
             },

+ 45
- 16
modules/UI/util/MessageHandler.js Visa fil

@@ -7,10 +7,19 @@ var messageHandler = (function(my) {
7 7
      * @param titleString the title of the message
8 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 23
                 persistent: false
15 24
             }
16 25
         );
@@ -27,13 +36,26 @@ var messageHandler = (function(my) {
27 36
      * @param loadedFunction function to be called after the prompt is fully loaded
28 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 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 59
             persistent: false,
38 60
             buttons: buttons,
39 61
             defaultButton: 1,
@@ -130,8 +152,9 @@ var messageHandler = (function(my) {
130 152
      * @param msgString the text of the message
131 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 158
         console.log(error);
136 159
         //FIXME send the error to the server
137 160
     };
@@ -141,12 +164,18 @@ var messageHandler = (function(my) {
141 164
      * @param title the title of the message
142 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 181
     my.notify = function(displayName, displayNameKey, displayNameDefault,

+ 4
- 2
modules/desktopsharing/desktopsharing.js Visa fil

@@ -92,7 +92,8 @@ function isUpdateRequired(minVersion, extVersion)
92 92
     catch (e)
93 93
     {
94 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 97
             'Error when trying to detect desktopsharing extension.');
97 98
         return true;
98 99
     }
@@ -174,7 +175,8 @@ function obtainScreenFromExtension(streamCallback, failCallback) {
174 175
                     function (arg) {
175 176
                         console.log("Failed to install the extension", arg);
176 177
                         failCallback(arg);
177
-                        APP.UI.messageHandler.showError('Error',
178
+                        APP.UI.messageHandler.showError("dialog.error", 'Error',
179
+                            "dialog.failtoinstall",
178 180
                             'Failed to install desktop sharing extension');
179 181
                     }
180 182
                 );

+ 22
- 3
modules/translation/translation.js Visa fil

@@ -14,6 +14,7 @@ var defaultOptions = {
14 14
     detectLngQS: "lang",
15 15
     useCookie: false,
16 16
     fallbackLng: DEFAULT_LANG,
17
+    shortcutFunction: 'defaultValue',
17 18
     load: "unspecific",
18 19
     resGetPath: 'lang/__ns__-__lng__.json',
19 20
     ns: {
@@ -82,13 +83,13 @@ module.exports = {
82 83
             options.lng = lang;
83 84
         i18n.init(options, initCompleted);
84 85
     },
85
-    translateString: function (key, cb, defaultValue) {
86
+    translateString: function (key, cb, options) {
86 87
         if(!cb)
87
-            return i18n.t(key, defaultValue);
88
+            return i18n.t(key, options);
88 89
 
89 90
         if(initialized)
90 91
         {
91
-            cb(i18n.t(key, defaultValue));
92
+            cb(i18n.t(key, options));
92 93
         }
93 94
         else
94 95
         {
@@ -106,5 +107,23 @@ module.exports = {
106 107
     },
107 108
     translateElement: function (selector) {
108 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 Visa fil

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

+ 10
- 5
modules/xmpp/strophe.emuc.js Visa fil

@@ -271,21 +271,26 @@ module.exports = function(XMPP, eventEmitter) {
271 271
                     // We're either missing Jicofo/Prosody config for anonymous
272 272
                     // domains or something is wrong.
273 273
 //                    XMPP.promptLogin();
274
-                    APP.UI.messageHandler.openReportDialog(null,
274
+                    APP.UI.messageHandler.openReportDialog(null, null,
275
+                        "dialog.joinError",
275 276
                         'Oops ! We couldn`t join the conference.' +
276 277
                         ' There might be some problem with security' +
277 278
                         ' configuration. Please contact service' +
278 279
                         ' administrator.', pres);
279 280
                 } else {
280 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 286
                         pres);
284 287
                 }
285 288
             } else {
286 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 294
                     pres);
290 295
             }
291 296
             return true;

+ 10
- 8
modules/xmpp/xmpp.js Visa fil

@@ -252,8 +252,8 @@ var XMPP = {
252 252
         } else {
253 253
             // We are done immediately
254 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 257
             callback();
258 258
         }
259 259
     },
@@ -314,9 +314,10 @@ var XMPP = {
314 314
                             },
315 315
                             function (error) {
316 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,9 +329,10 @@ var XMPP = {
328 329
             },
329 330
             function (error) {
330 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
         );

Laddar…
Avbryt
Spara