Adds multi language support for message handlers.
This commit is contained in:
parent
e16cee4187
commit
74f078f166
|
@ -19,7 +19,7 @@
|
|||
<script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
|
||||
<script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
|
||||
<script src="interface_config.js?v=5"></script>
|
||||
<script src="libs/app.bundle.js?v=13"></script>
|
||||
<script src="libs/app.bundle.js?v=14"></script>
|
||||
|
||||
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
|
||||
<link rel="stylesheet" href="css/font.css?v=6"/>
|
||||
|
|
|
@ -118,11 +118,59 @@
|
|||
"grantedTo": "Moderator rights granted to __to__!",
|
||||
"grantedToUnknown": "Moderator rights granted to $t(somebody)!"
|
||||
|
||||
},
|
||||
"dialog": {
|
||||
"kickMessage": "Ouch! You have been kicked out of the meet!",
|
||||
"popupError": "Your browser is blocking popup windows from this site. Please enable popups in your browser security settings and try again.",
|
||||
"passwordError": "This conversation is currently protected by a password. Only the owner of the conference could set a password.",
|
||||
"passwordError2": "This conversation isn't currently protected by a password. Only the owner of the conference could set a password.",
|
||||
"joinError": "Oops ! We couldn`t join the conference. There might be some problem with security configuration. Please contact service administrator.",
|
||||
"connectError": "Oops! Something went wrong and we couldn`t connect to the conference.",
|
||||
"error": "Error",
|
||||
"detectext": "Error when trying to detect desktopsharing extension.",
|
||||
"failtoinstall": "Failed to install desktop sharing extension",
|
||||
"failedpermissions": "Failed to obtain permissions to use the local microphone and/or camera.",
|
||||
"bridgeUnavailable": "Jitsi Videobridge is currently unavailable. Please try again later!",
|
||||
"lockTitle": "Lock failed",
|
||||
"lockMessage": "Failed to lock conference.",
|
||||
"warning": "Warning",
|
||||
"passwordNotSupported": "Room passwords are currently not supported.",
|
||||
"sorry": "Sorry",
|
||||
"internalError": "Internal application error[setRemoteDescription]",
|
||||
"unableToSwitch": "Unable to switch video stream.",
|
||||
"SLDFailure": "Oops! Something went wrong and we failed to mute! (SLD Failure)",
|
||||
"SRDFailure": "Oops! Something went wrong and we failed to stop video!(SRD Failure)",
|
||||
"oops": "Oops!",
|
||||
"defaultError": "There was some kind of error",
|
||||
"passwordRequired": "Password required",
|
||||
"Ok": "Ok",
|
||||
"removePreziTitle": "Remove Prezi",
|
||||
"removePreziMsg": "Are you sure you would like to remove your Prezi?",
|
||||
"sharePreziTitle": "Share a Prezi",
|
||||
"sharePreziMsg": "Another participant is already sharing a Prezi.This conference allows only one Prezi at a time.",
|
||||
"Remove": "Remove",
|
||||
"Stop": "Stop",
|
||||
"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.",
|
||||
"Authenticate": "Authenticate",
|
||||
"Cancel": "Cancel",
|
||||
"sessTerminated": "Session Terminated",
|
||||
"hungUp": "You hung up the call",
|
||||
"joinAgain": "Join again",
|
||||
"Share": "Share",
|
||||
"preziLinkError": "Please provide a correct prezi link.",
|
||||
"Save": "Save",
|
||||
"recordingToken": "Enter recording token",
|
||||
"Dial": "Dial",
|
||||
"sipMsg": "Enter SIP number",
|
||||
"passwordCheck": "Are you sure you would like to remove your password?",
|
||||
"Remove": "Remove",
|
||||
"passwordMsg": "Set a password to lock your room",
|
||||
"Invite": "Invite",
|
||||
"shareLink": "Share this link with everyone you want to invite",
|
||||
"settings1": "Configure your conference",
|
||||
"settings2": "Participants join muted",
|
||||
"settings3": "Require nicknames<br/><br/>Set a password to lock your room:",
|
||||
"yourPassword": "your password",
|
||||
"Back": "Back"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
34199
libs/app.bundle.js
34199
libs/app.bundle.js
File diff suppressed because it is too large
Load Diff
|
@ -315,10 +315,12 @@ RTCUtils.prototype.errorCallback = function (error) {
|
|||
return self.successCallback(stream);
|
||||
},
|
||||
function (error) {
|
||||
console.error('failed to obtain audio/video stream - stop', error);
|
||||
APP.UI.messageHandler.showError("Error",
|
||||
"Failed to obtain permissions to use the local microphone" +
|
||||
"and/or camera.");
|
||||
console.error('failed to obtain audio/video stream - stop',
|
||||
error);
|
||||
APP.UI.messageHandler.showError("dialog.error", "Error",
|
||||
"dialog.failedpermissions",
|
||||
"Failed to obtain permissions to use the local microphone " +
|
||||
"and/or camera.");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -136,11 +136,12 @@ function registerListeners() {
|
|||
VideoLayout.onStatsStop);
|
||||
APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
|
||||
APP.xmpp.addListener(XMPPEvents.KICKED, function () {
|
||||
messageHandler.openMessageDialog("Session Terminated",
|
||||
"Ouch! You have been kicked out of the meet!");
|
||||
messageHandler.openMessageDialog("dialog.sessTerminated", "Session Terminated",
|
||||
"dialog.kickMessage", "Ouch! You have been kicked out of the meet!");
|
||||
});
|
||||
APP.xmpp.addListener(XMPPEvents.BRIDGE_DOWN, function () {
|
||||
messageHandler.showError("Error",
|
||||
messageHandler.showError("dialog.error","Error",
|
||||
"dialog.bridgeUnavailable",
|
||||
"Jitsi Videobridge is currently unavailable. Please try again later!");
|
||||
});
|
||||
APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) {
|
||||
|
@ -442,12 +443,15 @@ function onModeratorStatusChanged(isModerator) {
|
|||
function onPasswordReqiured(callback) {
|
||||
// password is required
|
||||
Toolbar.lockLockButton();
|
||||
var message = '<h2 data-i18n="dialog.passwordRequired">';
|
||||
message += APP.translation.translateString(
|
||||
"dialog.passwordRequired", null, "Password required");
|
||||
message += '</h2>' +
|
||||
'<input id="lockKey" type="text" placeholder="password" autofocus>';
|
||||
|
||||
messageHandler.openTwoButtonDialog(null,
|
||||
'<h2>Password required</h2>' +
|
||||
'<input id="lockKey" type="text" placeholder="password" autofocus>',
|
||||
messageHandler.openTwoButtonDialog(null, null, null, message,
|
||||
true,
|
||||
"Ok",
|
||||
"dialog.Ok",
|
||||
function (e, v, m, f) {},
|
||||
function (event) {
|
||||
document.getElementById('lockKey').focus();
|
||||
|
@ -605,13 +609,17 @@ UI.disableConnect = function () {
|
|||
UI.showLoginPopup = function(callback)
|
||||
{
|
||||
console.log('password is required');
|
||||
|
||||
UI.messageHandler.openTwoButtonDialog(null,
|
||||
'<h2>Password required</h2>' +
|
||||
'<input id="passwordrequired.username" type="text" placeholder="user@domain.net" autofocus>' +
|
||||
'<input id="passwordrequired.password" type="password" placeholder="user password">',
|
||||
var message = '<h2 data-i18n="dialog.passwordRequired">';
|
||||
message += APP.translation.translateString(
|
||||
"dialog.passwordRequired", null, "Password required");
|
||||
message += '</h2>' +
|
||||
'<input id="passwordrequired.username" type="text" ' +
|
||||
'placeholder="user@domain.net" autofocus>' +
|
||||
'<input id="passwordrequired.password" ' +
|
||||
'type="password" placeholder="user password">';
|
||||
UI.messageHandler.openTwoButtonDialog(null, null, null, message,
|
||||
true,
|
||||
"Ok",
|
||||
"dialog.Ok",
|
||||
function (e, v, m, f) {
|
||||
if (v) {
|
||||
var username = document.getElementById('passwordrequired.username');
|
||||
|
|
|
@ -16,15 +16,24 @@ var Authentication = {
|
|||
// extract room name from 'room@muc.server.net'
|
||||
var room = roomName.substr(0, roomName.indexOf('@'));
|
||||
|
||||
var title = APP.translation.generateTranslatonHTML("dialog.Stop",
|
||||
"Stop");
|
||||
var defMsg = '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.';
|
||||
var msg = APP.translation.generateTranslatonHTML("dialog.AuthMsg",
|
||||
defMsg, {room: room});
|
||||
var button = APP.translation.generateTranslatonHTML(
|
||||
"dialog.Authenticate", "Authenticate");
|
||||
var buttons = {};
|
||||
buttons.authenticate = {title: button, value: "authNow"};
|
||||
|
||||
authDialog = APP.UI.messageHandler.openDialog(
|
||||
'Stop',
|
||||
'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.',
|
||||
title,
|
||||
msg,
|
||||
true,
|
||||
{
|
||||
Authenticate: 'authNow'
|
||||
},
|
||||
buttons,
|
||||
function (onSubmitEvent, submitValue) {
|
||||
|
||||
// Do not close the dialog yet
|
||||
|
|
|
@ -33,10 +33,11 @@ var Prezi = {
|
|||
openPreziDialog: function() {
|
||||
var myprezi = APP.xmpp.getPrezi();
|
||||
if (myprezi) {
|
||||
messageHandler.openTwoButtonDialog("Remove Prezi",
|
||||
messageHandler.openTwoButtonDialog("dialog.removePreziTitle",
|
||||
"Remove Prezi", "dialog.removePreziMsg",
|
||||
"Are you sure you would like to remove your Prezi?",
|
||||
false,
|
||||
"Remove",
|
||||
"dialog.Remove",
|
||||
function(e,v,m,f) {
|
||||
if(v) {
|
||||
APP.xmpp.removePreziFromPresence();
|
||||
|
@ -45,25 +46,41 @@ var Prezi = {
|
|||
);
|
||||
}
|
||||
else if (preziPlayer != null) {
|
||||
messageHandler.openTwoButtonDialog("Share a Prezi",
|
||||
messageHandler.openTwoButtonDialog("dialog.sharePreziTitle",
|
||||
"Share a Prezi", "dialog.sharePreziMsg",
|
||||
"Another participant is already sharing a Prezi." +
|
||||
"This conference allows only one Prezi at a time.",
|
||||
false,
|
||||
"Ok",
|
||||
"dialog.Ok",
|
||||
function(e,v,m,f) {
|
||||
$.prompt.close();
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
var html = APP.translation.generateTranslatonHTML(
|
||||
"dialog.sharePreziTitle", "Share a Prezi");
|
||||
var cancelButton = APP.translation.generateTranslatonHTML(
|
||||
"dialog.Cancel", "Cancel");
|
||||
var shareButton = APP.translation.generateTranslatonHTML(
|
||||
"dialog.Share", "Share");
|
||||
var backButton = APP.translation.generateTranslatonHTML(
|
||||
"dialog.Back", "Back");
|
||||
var buttons = {};
|
||||
var buttons1 = {};
|
||||
buttons1.Cancel = buttons.Cancel = {title: cancelButton, value: false};
|
||||
buttons.share = {title: shareButton, value: true};
|
||||
buttons1.Back = {title: backButton, value: true};
|
||||
var linkError = APP.translation.generateTranslatonHTML(
|
||||
"dialog.preziLinkError", "Please provide a correct prezi link.")
|
||||
var openPreziState = {
|
||||
state0: {
|
||||
html: '<h2>Share a Prezi</h2>' +
|
||||
html: '<h2>' + html + '</h2>' +
|
||||
'<input id="preziUrl" type="text" ' +
|
||||
'placeholder="e.g. ' +
|
||||
'http://prezi.com/wz7vhjycl7e6/my-prezi" autofocus>',
|
||||
persistent: false,
|
||||
buttons: { "Share": true , "Cancel": false},
|
||||
buttons: buttons,
|
||||
defaultButton: 1,
|
||||
submit: function(e,v,m,f){
|
||||
e.preventDefault();
|
||||
|
@ -102,10 +119,10 @@ var Prezi = {
|
|||
}
|
||||
},
|
||||
state1: {
|
||||
html: '<h2>Share a Prezi</h2>' +
|
||||
'Please provide a correct prezi link.',
|
||||
html: '<h2>' + html + '</h2>' +
|
||||
linkError,
|
||||
persistent: false,
|
||||
buttons: { "Back": true, "Cancel": false },
|
||||
buttons: buttons1,
|
||||
defaultButton: 1,
|
||||
submit:function(e,v,m,f) {
|
||||
e.preventDefault();
|
||||
|
|
|
@ -95,11 +95,20 @@ function hangup() {
|
|||
|
||||
}
|
||||
|
||||
var title = APP.translation.generateTranslatonHTML(
|
||||
"dialog.sessTerminated", "Session Terminated");
|
||||
var msg = APP.translation.generateTranslatonHTML(
|
||||
"dialog.hungUp","You hung up the call");
|
||||
var button = APP.translation.generateTranslatonHTML(
|
||||
"dialog.joinAgain", "Join again");
|
||||
var buttons = {};
|
||||
buttons.joinAgain = {title: button, value: true};
|
||||
|
||||
UI.messageHandler.openDialog(
|
||||
"Session Terminated",
|
||||
"You hung up the call",
|
||||
title,
|
||||
msg,
|
||||
true,
|
||||
{ "Join again": true },
|
||||
buttons,
|
||||
function(event, value, message, formVals)
|
||||
{
|
||||
window.location.reload();
|
||||
|
@ -114,12 +123,14 @@ function hangup() {
|
|||
|
||||
function toggleRecording() {
|
||||
APP.xmpp.toggleRecording(function (callback) {
|
||||
APP.UI.messageHandler.openTwoButtonDialog(null,
|
||||
'<h2>Enter recording token</h2>' +
|
||||
var msg = APP.translation.generateTranslatonHTML(
|
||||
"dialog.recordingToken", "Enter recording token");
|
||||
APP.UI.messageHandler.openTwoButtonDialog(null, null, null,
|
||||
'<h2>' + msg + '</h2>' +
|
||||
'<input id="recordingToken" type="text" ' +
|
||||
'placeholder="token" autofocus>',
|
||||
false,
|
||||
"Save",
|
||||
"dialog.Save",
|
||||
function (e, v, m, f) {
|
||||
if (v) {
|
||||
var token = document.getElementById('recordingToken');
|
||||
|
@ -160,13 +171,15 @@ function lockRoom(lock) {
|
|||
}
|
||||
}, function (err) {
|
||||
console.warn('setting password failed', err);
|
||||
messageHandler.showError('Lock failed',
|
||||
messageHandler.showError("dialog.lockTitle", 'Lock failed',
|
||||
"dialog.lockMessage",
|
||||
'Failed to lock conference.',
|
||||
err);
|
||||
Toolbar.setSharedKey('');
|
||||
}, function () {
|
||||
console.warn('room passwords not supported');
|
||||
messageHandler.showError('Warning',
|
||||
messageHandler.showError("dialog.warning", 'Warning',
|
||||
"dialog.passwordNotSupported",
|
||||
'Room passwords are currently not supported.');
|
||||
Toolbar.setSharedKey('');
|
||||
});
|
||||
|
@ -218,12 +231,14 @@ function callSipButtonClicked()
|
|||
var defaultNumber
|
||||
= config.defaultSipNumber ? config.defaultSipNumber : '';
|
||||
|
||||
messageHandler.openTwoButtonDialog(null,
|
||||
'<h2>Enter SIP number</h2>' +
|
||||
var sipMsg = APP.translation.generateTranslatonHTML(
|
||||
"dialog.sipMsg", "Enter SIP number");
|
||||
messageHandler.openTwoButtonDialog(null, null, null,
|
||||
'<h2>' + sipMsg + '</h2>' +
|
||||
'<input id="sipNumber" type="text"' +
|
||||
' value="' + defaultNumber + '" autofocus>',
|
||||
false,
|
||||
"Dial",
|
||||
"dialog.Dial",
|
||||
function (e, v, m, f) {
|
||||
if (v) {
|
||||
var numberInput = document.getElementById('sipNumber');
|
||||
|
@ -302,7 +317,8 @@ var Toolbar = (function (my) {
|
|||
}, url);
|
||||
if (!authenticationWindow) {
|
||||
messageHandler.openMessageDialog(
|
||||
null, "Your browser is blocking popup windows from this site." +
|
||||
null, null, "dialog.popupError",
|
||||
"Your browser is blocking popup windows from this site." +
|
||||
" Please enable popups in your browser security settings" +
|
||||
" and try again.");
|
||||
}
|
||||
|
@ -342,14 +358,15 @@ var Toolbar = (function (my) {
|
|||
// Only the focus is able to set a shared key.
|
||||
if (!APP.xmpp.isModerator()) {
|
||||
if (sharedKey) {
|
||||
messageHandler.openMessageDialog(null,
|
||||
messageHandler.openMessageDialog(null, null,
|
||||
"dialog.passwordError",
|
||||
"This conversation is currently protected by" +
|
||||
" a password. Only the owner of the conference" +
|
||||
" could set a password.",
|
||||
false,
|
||||
"Password");
|
||||
} else {
|
||||
messageHandler.openMessageDialog(null,
|
||||
messageHandler.openMessageDialog(null, null, "dialog.passwordError2",
|
||||
"This conversation isn't currently protected by" +
|
||||
" a password. Only the owner of the conference" +
|
||||
" could set a password.",
|
||||
|
@ -358,10 +375,11 @@ var Toolbar = (function (my) {
|
|||
}
|
||||
} else {
|
||||
if (sharedKey) {
|
||||
messageHandler.openTwoButtonDialog(null,
|
||||
messageHandler.openTwoButtonDialog(null, null,
|
||||
"dialog.passwordCheck",
|
||||
"Are you sure you would like to remove your password?",
|
||||
false,
|
||||
"Remove",
|
||||
"dialog.Remove",
|
||||
function (e, v) {
|
||||
if (v) {
|
||||
Toolbar.setSharedKey('');
|
||||
|
@ -369,12 +387,16 @@ var Toolbar = (function (my) {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
messageHandler.openTwoButtonDialog(null,
|
||||
'<h2>Set a password to lock your room</h2>' +
|
||||
var msg = APP.translation.generateTranslatonHTML(
|
||||
"dialog.passwordMsg", "Set a password to lock your room");
|
||||
var yourPassword = APP.translation.translateString(
|
||||
"dialog.yourPassword", null, "your password");
|
||||
messageHandler.openTwoButtonDialog(null, null, null,
|
||||
'<h2>' + msg + '</h2>' +
|
||||
'<input id="lockKey" type="text"' +
|
||||
'placeholder="your password" autofocus>',
|
||||
'placeholder="' + yourPassword + '" autofocus>',
|
||||
false,
|
||||
"Save",
|
||||
"dialog.Save",
|
||||
function (e, v) {
|
||||
if (v) {
|
||||
var lockKey = document.getElementById('lockKey');
|
||||
|
@ -403,12 +425,12 @@ var Toolbar = (function (my) {
|
|||
} else {
|
||||
inviteLink = encodeURI(roomUrl);
|
||||
}
|
||||
messageHandler.openTwoButtonDialog(
|
||||
"Share this link with everyone you want to invite",
|
||||
messageHandler.openTwoButtonDialog("dialog.shareLink",
|
||||
"Share this link with everyone you want to invite", null,
|
||||
'<input id="inviteLinkRef" type="text" value="' +
|
||||
inviteLink + '" onclick="this.select();" readonly>',
|
||||
false,
|
||||
"Invite",
|
||||
"dialog.Invite",
|
||||
function (e, v) {
|
||||
if (v) {
|
||||
if (roomUrl) {
|
||||
|
@ -431,18 +453,29 @@ var Toolbar = (function (my) {
|
|||
* Opens the settings dialog.
|
||||
*/
|
||||
my.openSettingsDialog = function () {
|
||||
messageHandler.openTwoButtonDialog(
|
||||
'<h2>Configure your conference</h2>' +
|
||||
var settings1 = APP.translation.generateTranslatonHTML(
|
||||
"dialog.settings1", "Configure your conference");
|
||||
var settings2 = APP.translation.generateTranslatonHTML(
|
||||
"dialog.settings2", "Participants join muted");
|
||||
var settings3 = APP.translation.generateTranslatonHTML(
|
||||
"dialog.settings3", "Require nicknames<br/><br/>" +
|
||||
"Set a password to lock your room:");
|
||||
|
||||
var yourPassword = APP.translation.translateString(
|
||||
"dialog.yourPassword", null, "your password");
|
||||
|
||||
messageHandler.openTwoButtonDialog(null,
|
||||
'<h2>' + settings1 + '</h2>' +
|
||||
'<input type="checkbox" id="initMuted">' +
|
||||
'Participants join muted<br/>' +
|
||||
settings2 + '<br/>' +
|
||||
'<input type="checkbox" id="requireNicknames">' +
|
||||
'Require nicknames<br/><br/>' +
|
||||
'Set a password to lock your room:' +
|
||||
'<input id="lockKey" type="text" placeholder="your password"' +
|
||||
'autofocus>',
|
||||
settings3 +
|
||||
'<input id="lockKey" type="text" placeholder="' + yourPassword +
|
||||
'" data-i18n="[placeholder]dialog.yourPassword" autofocus>',
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
"Save",
|
||||
"dialog.Save",
|
||||
function () {
|
||||
document.getElementById('lockKey').focus();
|
||||
},
|
||||
|
|
|
@ -7,10 +7,19 @@ var messageHandler = (function(my) {
|
|||
* @param titleString the title of the message
|
||||
* @param messageString the text of the message
|
||||
*/
|
||||
my.openMessageDialog = function(titleString, messageString) {
|
||||
$.prompt(messageString,
|
||||
my.openMessageDialog = function(titleKey, titleString,
|
||||
messageKey, messageString) {
|
||||
var title = null;
|
||||
if(titleKey)
|
||||
{
|
||||
title = APP.translation.generateTranslatonHTML(titleKey,
|
||||
titleString);
|
||||
}
|
||||
var message = APP.translation.generateTranslatonHTML(messageKey,
|
||||
messageString);
|
||||
$.prompt(message,
|
||||
{
|
||||
title: titleString,
|
||||
title: title,
|
||||
persistent: false
|
||||
}
|
||||
);
|
||||
|
@ -27,13 +36,26 @@ var messageHandler = (function(my) {
|
|||
* @param loadedFunction function to be called after the prompt is fully loaded
|
||||
* @param closeFunction function to be called after the prompt is closed
|
||||
*/
|
||||
my.openTwoButtonDialog = function(titleString, msgString, persistent, leftButton,
|
||||
submitFunction, loadedFunction, closeFunction) {
|
||||
my.openTwoButtonDialog = function(titleKey, titleString, msgKey, msgString,
|
||||
persistent, leftButtonKey, submitFunction, loadedFunction,
|
||||
closeFunction)
|
||||
{
|
||||
var leftButton = APP.translation.generateTranslatonHTML(leftButtonKey);
|
||||
var buttons = {};
|
||||
buttons[leftButton] = true;
|
||||
buttons.Cancel = false;
|
||||
$.prompt(msgString, {
|
||||
title: titleString,
|
||||
buttons.leftButton = {title: leftButton, value: true};
|
||||
var cancelButton = APP.translation.generateTranslatonHTML("dialog.Cancel",
|
||||
"Cancel");
|
||||
buttons.Cancel = {title: cancelButton, value: false};
|
||||
var message = msgString, title = titleString;
|
||||
if(titleKey)
|
||||
{
|
||||
title = APP.translation.generateTranslatonHTML(titleKey, titleString);
|
||||
}
|
||||
if(msgKey) {
|
||||
message = APP.translation.generateTranslatonHTML(msgKey, msgString);
|
||||
}
|
||||
$.prompt(message, {
|
||||
title: title,
|
||||
persistent: false,
|
||||
buttons: buttons,
|
||||
defaultButton: 1,
|
||||
|
@ -130,8 +152,9 @@ var messageHandler = (function(my) {
|
|||
* @param msgString the text of the message
|
||||
* @param error the error that is being reported
|
||||
*/
|
||||
my.openReportDialog = function(titleString, msgString, error) {
|
||||
my.openMessageDialog(titleString, msgString);
|
||||
my.openReportDialog = function(titleKey, titleString, msgKey,
|
||||
msgString, error) {
|
||||
my.openMessageDialog(titleKey, titleString, msgKey, msgString);
|
||||
console.log(error);
|
||||
//FIXME send the error to the server
|
||||
};
|
||||
|
@ -141,12 +164,18 @@ var messageHandler = (function(my) {
|
|||
* @param title the title of the message
|
||||
* @param message the text of the messafe
|
||||
*/
|
||||
my.showError = function(title, message) {
|
||||
if(!(title || message)) {
|
||||
title = title || "Oops!";
|
||||
message = message || "There was some kind of error";
|
||||
my.showError = function(titleKey, title, msgKey, message) {
|
||||
|
||||
if(!titleKey) {
|
||||
title = "Oops!";
|
||||
titleKey = "dialog.oops";
|
||||
}
|
||||
messageHandler.openMessageDialog(title, message);
|
||||
if(!msgKey)
|
||||
{
|
||||
message = "There was some kind of error";
|
||||
msgKey = "dialog.defaultError";
|
||||
}
|
||||
messageHandler.openMessageDialog(titleKey, title, msgKey, message);
|
||||
};
|
||||
|
||||
my.notify = function(displayName, displayNameKey, displayNameDefault,
|
||||
|
|
|
@ -92,7 +92,8 @@ function isUpdateRequired(minVersion, extVersion)
|
|||
catch (e)
|
||||
{
|
||||
console.error("Failed to parse extension version", e);
|
||||
APP.UI.messageHandler.showError('Error',
|
||||
APP.UI.messageHandler.showError("dialog.error", 'Error',
|
||||
"dialod.detectext",
|
||||
'Error when trying to detect desktopsharing extension.');
|
||||
return true;
|
||||
}
|
||||
|
@ -174,7 +175,8 @@ function obtainScreenFromExtension(streamCallback, failCallback) {
|
|||
function (arg) {
|
||||
console.log("Failed to install the extension", arg);
|
||||
failCallback(arg);
|
||||
APP.UI.messageHandler.showError('Error',
|
||||
APP.UI.messageHandler.showError("dialog.error", 'Error',
|
||||
"dialog.failtoinstall",
|
||||
'Failed to install desktop sharing extension');
|
||||
}
|
||||
);
|
||||
|
|
|
@ -14,6 +14,7 @@ var defaultOptions = {
|
|||
detectLngQS: "lang",
|
||||
useCookie: false,
|
||||
fallbackLng: DEFAULT_LANG,
|
||||
shortcutFunction: 'defaultValue',
|
||||
load: "unspecific",
|
||||
resGetPath: 'lang/__ns__-__lng__.json',
|
||||
ns: {
|
||||
|
@ -82,13 +83,13 @@ module.exports = {
|
|||
options.lng = lang;
|
||||
i18n.init(options, initCompleted);
|
||||
},
|
||||
translateString: function (key, cb, defaultValue) {
|
||||
translateString: function (key, cb, options) {
|
||||
if(!cb)
|
||||
return i18n.t(key, defaultValue);
|
||||
return i18n.t(key, options);
|
||||
|
||||
if(initialized)
|
||||
{
|
||||
cb(i18n.t(key, defaultValue));
|
||||
cb(i18n.t(key, options));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -106,5 +107,23 @@ module.exports = {
|
|||
},
|
||||
translateElement: function (selector) {
|
||||
selector.i18n();
|
||||
},
|
||||
generateTranslatonHTML: function (key, defaultString, options) {
|
||||
var str = "<span data-i18n=\"" + key + "\"";
|
||||
if(options)
|
||||
{
|
||||
str += " data-i18n-options=\"" + JSON.stringify(options) + "\"";
|
||||
}
|
||||
str += ">";
|
||||
if(!options)
|
||||
options = {};
|
||||
if(defaultString)
|
||||
{
|
||||
options.defaultValue = defaultString;
|
||||
}
|
||||
str += this.translateString(key, null, options);
|
||||
str += "</span>";
|
||||
return str;
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1226,7 +1226,8 @@ JingleSession.onJingleFatalError = function (session, error)
|
|||
{
|
||||
this.service.sessionTerminated = true;
|
||||
this.connection.emuc.doLeave();
|
||||
APP.UI.messageHandler.showError( "Sorry",
|
||||
APP.UI.messageHandler.showError("dialog.sorry", "Sorry",
|
||||
"dialog.internalError",
|
||||
"Internal application error[setRemoteDescription]");
|
||||
}
|
||||
|
||||
|
|
|
@ -271,21 +271,26 @@ module.exports = function(XMPP, eventEmitter) {
|
|||
// We're either missing Jicofo/Prosody config for anonymous
|
||||
// domains or something is wrong.
|
||||
// XMPP.promptLogin();
|
||||
APP.UI.messageHandler.openReportDialog(null,
|
||||
APP.UI.messageHandler.openReportDialog(null, null,
|
||||
"dialog.joinError",
|
||||
'Oops ! We couldn`t join the conference.' +
|
||||
' There might be some problem with security' +
|
||||
' configuration. Please contact service' +
|
||||
' administrator.', pres);
|
||||
} else {
|
||||
console.warn('onPresError ', pres);
|
||||
APP.UI.messageHandler.openReportDialog(null,
|
||||
'Oops! Something went wrong and we couldn`t connect to the conference.',
|
||||
APP.UI.messageHandler.openReportDialog(null, null,
|
||||
"dialog.connectError",
|
||||
'Oops! Something went wrong and we couldn`t ' +
|
||||
'connect to the conference.',
|
||||
pres);
|
||||
}
|
||||
} else {
|
||||
console.warn('onPresError ', pres);
|
||||
APP.UI.messageHandler.openReportDialog(null,
|
||||
'Oops! Something went wrong and we couldn`t connect to the conference.',
|
||||
APP.UI.messageHandler.openReportDialog(null, null,
|
||||
"dialog.connectError",
|
||||
'Oops! Something went wrong and we couldn`t ' +
|
||||
'connect to the conference.',
|
||||
pres);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -252,8 +252,8 @@ var XMPP = {
|
|||
} else {
|
||||
// We are done immediately
|
||||
console.error("No conference handler");
|
||||
APP.UI.messageHandler.showError('Error',
|
||||
'Unable to switch video stream.');
|
||||
APP.UI.messageHandler.showError("dialog.error", 'Error',
|
||||
"dialog.unableToSwitch", 'Unable to switch video stream.');
|
||||
callback();
|
||||
}
|
||||
},
|
||||
|
@ -314,9 +314,10 @@ var XMPP = {
|
|||
},
|
||||
function (error) {
|
||||
console.log('mute SLD error');
|
||||
APP.UI.messageHandler.showError('Error',
|
||||
'Oops! Something went wrong and we failed to ' +
|
||||
'mute! (SLD Failure)');
|
||||
APP.UI.messageHandler.showError("dialog.error",
|
||||
'Error', "dialog.SLDFailure",
|
||||
'Oops! Something went wrong and we failed to ' +
|
||||
'mute! (SLD Failure)');
|
||||
}
|
||||
);
|
||||
},
|
||||
|
@ -328,9 +329,10 @@ var XMPP = {
|
|||
},
|
||||
function (error) {
|
||||
console.log('muteVideo SRD error');
|
||||
APP.UI.messageHandler.showError('Error',
|
||||
'Oops! Something went wrong and we failed to stop video!' +
|
||||
'(SRD Failure)');
|
||||
APP.UI.messageHandler.showError("dialog.error", 'Error',
|
||||
"dialog.SRDFailure",
|
||||
'Oops! Something went wrong and we failed to stop video!' +
|
||||
'(SRD Failure)');
|
||||
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue