Adds multi language support for message handlers.

This commit is contained in:
hristoterezov 2015-02-20 18:17:46 +02:00
parent e16cee4187
commit 74f078f166
14 changed files with 17445 additions and 17143 deletions

View File

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

View File

@ -118,11 +118,59 @@
"grantedTo": "Moderator rights granted to __to__!", "grantedTo": "Moderator rights granted to __to__!",
"grantedToUnknown": "Moderator rights granted to $t(somebody)!" "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"
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -315,8 +315,10 @@ RTCUtils.prototype.errorCallback = function (error) {
return self.successCallback(stream); return self.successCallback(stream);
}, },
function (error) { function (error) {
console.error('failed to obtain audio/video stream - stop', error); console.error('failed to obtain audio/video stream - stop',
APP.UI.messageHandler.showError("Error", error);
APP.UI.messageHandler.showError("dialog.error", "Error",
"dialog.failedpermissions",
"Failed to obtain permissions to use the local microphone " + "Failed to obtain permissions to use the local microphone " +
"and/or camera."); "and/or camera.");
} }

View File

@ -136,11 +136,12 @@ function registerListeners() {
VideoLayout.onStatsStop); VideoLayout.onStatsStop);
APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference); APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
APP.xmpp.addListener(XMPPEvents.KICKED, function () { APP.xmpp.addListener(XMPPEvents.KICKED, function () {
messageHandler.openMessageDialog("Session Terminated", messageHandler.openMessageDialog("dialog.sessTerminated", "Session Terminated",
"Ouch! You have been kicked out of the meet!"); "dialog.kickMessage", "Ouch! You have been kicked out of the meet!");
}); });
APP.xmpp.addListener(XMPPEvents.BRIDGE_DOWN, function () { 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!"); "Jitsi Videobridge is currently unavailable. Please try again later!");
}); });
APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) { APP.xmpp.addListener(XMPPEvents.USER_ID_CHANGED, function (from, id) {
@ -442,12 +443,15 @@ function onModeratorStatusChanged(isModerator) {
function onPasswordReqiured(callback) { function onPasswordReqiured(callback) {
// password is required // password is required
Toolbar.lockLockButton(); 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, messageHandler.openTwoButtonDialog(null, null, null, message,
'<h2>Password required</h2>' +
'<input id="lockKey" type="text" placeholder="password" autofocus>',
true, true,
"Ok", "dialog.Ok",
function (e, v, m, f) {}, function (e, v, m, f) {},
function (event) { function (event) {
document.getElementById('lockKey').focus(); document.getElementById('lockKey').focus();
@ -605,13 +609,17 @@ UI.disableConnect = function () {
UI.showLoginPopup = function(callback) UI.showLoginPopup = function(callback)
{ {
console.log('password is required'); console.log('password is required');
var message = '<h2 data-i18n="dialog.passwordRequired">';
UI.messageHandler.openTwoButtonDialog(null, message += APP.translation.translateString(
'<h2>Password required</h2>' + "dialog.passwordRequired", null, "Password required");
'<input id="passwordrequired.username" type="text" placeholder="user@domain.net" autofocus>' + message += '</h2>' +
'<input id="passwordrequired.password" type="password" placeholder="user password">', '<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, true,
"Ok", "dialog.Ok",
function (e, v, m, f) { function (e, v, m, f) {
if (v) { if (v) {
var username = document.getElementById('passwordrequired.username'); var username = document.getElementById('passwordrequired.username');

View File

@ -16,15 +16,24 @@ var Authentication = {
// extract room name from 'room@muc.server.net' // extract room name from 'room@muc.server.net'
var room = roomName.substr(0, roomName.indexOf('@')); var room = roomName.substr(0, roomName.indexOf('@'));
authDialog = APP.UI.messageHandler.openDialog( var title = APP.translation.generateTranslatonHTML("dialog.Stop",
'Stop', "Stop");
'Authentication is required to create room:<br/><b>' + room + var defMsg = 'Authentication is required to create room:<br/><b>' +
room +
'</b></br> You can either authenticate to create the room or ' + '</b></br> You can either authenticate to create the room or ' +
'just wait for someone else to do so.', '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(
title,
msg,
true, true,
{ buttons,
Authenticate: 'authNow'
},
function (onSubmitEvent, submitValue) { function (onSubmitEvent, submitValue) {
// Do not close the dialog yet // Do not close the dialog yet

View File

@ -33,10 +33,11 @@ var Prezi = {
openPreziDialog: function() { openPreziDialog: function() {
var myprezi = APP.xmpp.getPrezi(); var myprezi = APP.xmpp.getPrezi();
if (myprezi) { if (myprezi) {
messageHandler.openTwoButtonDialog("Remove Prezi", messageHandler.openTwoButtonDialog("dialog.removePreziTitle",
"Remove Prezi", "dialog.removePreziMsg",
"Are you sure you would like to remove your Prezi?", "Are you sure you would like to remove your Prezi?",
false, false,
"Remove", "dialog.Remove",
function(e,v,m,f) { function(e,v,m,f) {
if(v) { if(v) {
APP.xmpp.removePreziFromPresence(); APP.xmpp.removePreziFromPresence();
@ -45,25 +46,41 @@ var Prezi = {
); );
} }
else if (preziPlayer != null) { 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." + "Another participant is already sharing a Prezi." +
"This conference allows only one Prezi at a time.", "This conference allows only one Prezi at a time.",
false, false,
"Ok", "dialog.Ok",
function(e,v,m,f) { function(e,v,m,f) {
$.prompt.close(); $.prompt.close();
} }
); );
} }
else { 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 = { var openPreziState = {
state0: { state0: {
html: '<h2>Share a Prezi</h2>' + html: '<h2>' + html + '</h2>' +
'<input id="preziUrl" type="text" ' + '<input id="preziUrl" type="text" ' +
'placeholder="e.g. ' + 'placeholder="e.g. ' +
'http://prezi.com/wz7vhjycl7e6/my-prezi" autofocus>', 'http://prezi.com/wz7vhjycl7e6/my-prezi" autofocus>',
persistent: false, persistent: false,
buttons: { "Share": true , "Cancel": false}, buttons: buttons,
defaultButton: 1, defaultButton: 1,
submit: function(e,v,m,f){ submit: function(e,v,m,f){
e.preventDefault(); e.preventDefault();
@ -102,10 +119,10 @@ var Prezi = {
} }
}, },
state1: { state1: {
html: '<h2>Share a Prezi</h2>' + html: '<h2>' + html + '</h2>' +
'Please provide a correct prezi link.', linkError,
persistent: false, persistent: false,
buttons: { "Back": true, "Cancel": false }, buttons: buttons1,
defaultButton: 1, defaultButton: 1,
submit:function(e,v,m,f) { submit:function(e,v,m,f) {
e.preventDefault(); e.preventDefault();

View File

@ -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( UI.messageHandler.openDialog(
"Session Terminated", title,
"You hung up the call", msg,
true, true,
{ "Join again": true }, buttons,
function(event, value, message, formVals) function(event, value, message, formVals)
{ {
window.location.reload(); window.location.reload();
@ -114,12 +123,14 @@ function hangup() {
function toggleRecording() { function toggleRecording() {
APP.xmpp.toggleRecording(function (callback) { APP.xmpp.toggleRecording(function (callback) {
APP.UI.messageHandler.openTwoButtonDialog(null, var msg = APP.translation.generateTranslatonHTML(
'<h2>Enter recording token</h2>' + "dialog.recordingToken", "Enter recording token");
APP.UI.messageHandler.openTwoButtonDialog(null, null, null,
'<h2>' + msg + '</h2>' +
'<input id="recordingToken" type="text" ' + '<input id="recordingToken" type="text" ' +
'placeholder="token" autofocus>', 'placeholder="token" autofocus>',
false, false,
"Save", "dialog.Save",
function (e, v, m, f) { function (e, v, m, f) {
if (v) { if (v) {
var token = document.getElementById('recordingToken'); var token = document.getElementById('recordingToken');
@ -160,13 +171,15 @@ function lockRoom(lock) {
} }
}, function (err) { }, function (err) {
console.warn('setting password failed', err); console.warn('setting password failed', err);
messageHandler.showError('Lock failed', messageHandler.showError("dialog.lockTitle", 'Lock failed',
"dialog.lockMessage",
'Failed to lock conference.', 'Failed to lock conference.',
err); err);
Toolbar.setSharedKey(''); Toolbar.setSharedKey('');
}, function () { }, function () {
console.warn('room passwords not supported'); console.warn('room passwords not supported');
messageHandler.showError('Warning', messageHandler.showError("dialog.warning", 'Warning',
"dialog.passwordNotSupported",
'Room passwords are currently not supported.'); 'Room passwords are currently not supported.');
Toolbar.setSharedKey(''); Toolbar.setSharedKey('');
}); });
@ -218,12 +231,14 @@ function callSipButtonClicked()
var defaultNumber var defaultNumber
= config.defaultSipNumber ? config.defaultSipNumber : ''; = config.defaultSipNumber ? config.defaultSipNumber : '';
messageHandler.openTwoButtonDialog(null, var sipMsg = APP.translation.generateTranslatonHTML(
'<h2>Enter SIP number</h2>' + "dialog.sipMsg", "Enter SIP number");
messageHandler.openTwoButtonDialog(null, null, null,
'<h2>' + sipMsg + '</h2>' +
'<input id="sipNumber" type="text"' + '<input id="sipNumber" type="text"' +
' value="' + defaultNumber + '" autofocus>', ' value="' + defaultNumber + '" autofocus>',
false, false,
"Dial", "dialog.Dial",
function (e, v, m, f) { function (e, v, m, f) {
if (v) { if (v) {
var numberInput = document.getElementById('sipNumber'); var numberInput = document.getElementById('sipNumber');
@ -302,7 +317,8 @@ var Toolbar = (function (my) {
}, url); }, url);
if (!authenticationWindow) { if (!authenticationWindow) {
messageHandler.openMessageDialog( 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" + " Please enable popups in your browser security settings" +
" and try again."); " and try again.");
} }
@ -342,14 +358,15 @@ var Toolbar = (function (my) {
// Only the focus is able to set a shared key. // Only the focus is able to set a shared key.
if (!APP.xmpp.isModerator()) { if (!APP.xmpp.isModerator()) {
if (sharedKey) { if (sharedKey) {
messageHandler.openMessageDialog(null, messageHandler.openMessageDialog(null, null,
"dialog.passwordError",
"This conversation is currently protected by" + "This conversation is currently protected by" +
" a password. Only the owner of the conference" + " a password. Only the owner of the conference" +
" could set a password.", " could set a password.",
false, false,
"Password"); "Password");
} else { } else {
messageHandler.openMessageDialog(null, messageHandler.openMessageDialog(null, null, "dialog.passwordError2",
"This conversation isn't currently protected by" + "This conversation isn't currently protected by" +
" a password. Only the owner of the conference" + " a password. Only the owner of the conference" +
" could set a password.", " could set a password.",
@ -358,10 +375,11 @@ var Toolbar = (function (my) {
} }
} else { } else {
if (sharedKey) { if (sharedKey) {
messageHandler.openTwoButtonDialog(null, messageHandler.openTwoButtonDialog(null, null,
"dialog.passwordCheck",
"Are you sure you would like to remove your password?", "Are you sure you would like to remove your password?",
false, false,
"Remove", "dialog.Remove",
function (e, v) { function (e, v) {
if (v) { if (v) {
Toolbar.setSharedKey(''); Toolbar.setSharedKey('');
@ -369,12 +387,16 @@ var Toolbar = (function (my) {
} }
}); });
} else { } else {
messageHandler.openTwoButtonDialog(null, var msg = APP.translation.generateTranslatonHTML(
'<h2>Set a password to lock your room</h2>' + "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"' + '<input id="lockKey" type="text"' +
'placeholder="your password" autofocus>', 'placeholder="' + yourPassword + '" autofocus>',
false, false,
"Save", "dialog.Save",
function (e, v) { function (e, v) {
if (v) { if (v) {
var lockKey = document.getElementById('lockKey'); var lockKey = document.getElementById('lockKey');
@ -403,12 +425,12 @@ var Toolbar = (function (my) {
} else { } else {
inviteLink = encodeURI(roomUrl); inviteLink = encodeURI(roomUrl);
} }
messageHandler.openTwoButtonDialog( messageHandler.openTwoButtonDialog("dialog.shareLink",
"Share this link with everyone you want to invite", "Share this link with everyone you want to invite", null,
'<input id="inviteLinkRef" type="text" value="' + '<input id="inviteLinkRef" type="text" value="' +
inviteLink + '" onclick="this.select();" readonly>', inviteLink + '" onclick="this.select();" readonly>',
false, false,
"Invite", "dialog.Invite",
function (e, v) { function (e, v) {
if (v) { if (v) {
if (roomUrl) { if (roomUrl) {
@ -431,18 +453,29 @@ var Toolbar = (function (my) {
* Opens the settings dialog. * Opens the settings dialog.
*/ */
my.openSettingsDialog = function () { my.openSettingsDialog = function () {
messageHandler.openTwoButtonDialog( var settings1 = APP.translation.generateTranslatonHTML(
'<h2>Configure your conference</h2>' + "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">' + '<input type="checkbox" id="initMuted">' +
'Participants join muted<br/>' + settings2 + '<br/>' +
'<input type="checkbox" id="requireNicknames">' + '<input type="checkbox" id="requireNicknames">' +
'Require nicknames<br/><br/>' + settings3 +
'Set a password to lock your room:' + '<input id="lockKey" type="text" placeholder="' + yourPassword +
'<input id="lockKey" type="text" placeholder="your password"' + '" data-i18n="[placeholder]dialog.yourPassword" autofocus>',
'autofocus>', null,
null, null,
false, false,
"Save", "dialog.Save",
function () { function () {
document.getElementById('lockKey').focus(); document.getElementById('lockKey').focus();
}, },

View File

@ -7,10 +7,19 @@ var messageHandler = (function(my) {
* @param titleString the title of the message * @param titleString the title of the message
* @param messageString the text of the message * @param messageString the text of the message
*/ */
my.openMessageDialog = function(titleString, messageString) { my.openMessageDialog = function(titleKey, titleString,
$.prompt(messageString, messageKey, messageString) {
var title = null;
if(titleKey)
{ {
title: titleString, title = APP.translation.generateTranslatonHTML(titleKey,
titleString);
}
var message = APP.translation.generateTranslatonHTML(messageKey,
messageString);
$.prompt(message,
{
title: title,
persistent: false persistent: false
} }
); );
@ -27,13 +36,26 @@ var messageHandler = (function(my) {
* @param loadedFunction function to be called after the prompt is fully loaded * @param loadedFunction function to be called after the prompt is fully loaded
* @param closeFunction function to be called after the prompt is closed * @param closeFunction function to be called after the prompt is closed
*/ */
my.openTwoButtonDialog = function(titleString, msgString, persistent, leftButton, my.openTwoButtonDialog = function(titleKey, titleString, msgKey, msgString,
submitFunction, loadedFunction, closeFunction) { persistent, leftButtonKey, submitFunction, loadedFunction,
closeFunction)
{
var leftButton = APP.translation.generateTranslatonHTML(leftButtonKey);
var buttons = {}; var buttons = {};
buttons[leftButton] = true; buttons.leftButton = {title: leftButton, value: true};
buttons.Cancel = false; var cancelButton = APP.translation.generateTranslatonHTML("dialog.Cancel",
$.prompt(msgString, { "Cancel");
title: titleString, 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, persistent: false,
buttons: buttons, buttons: buttons,
defaultButton: 1, defaultButton: 1,
@ -130,8 +152,9 @@ var messageHandler = (function(my) {
* @param msgString the text of the message * @param msgString the text of the message
* @param error the error that is being reported * @param error the error that is being reported
*/ */
my.openReportDialog = function(titleString, msgString, error) { my.openReportDialog = function(titleKey, titleString, msgKey,
my.openMessageDialog(titleString, msgString); msgString, error) {
my.openMessageDialog(titleKey, titleString, msgKey, msgString);
console.log(error); console.log(error);
//FIXME send the error to the server //FIXME send the error to the server
}; };
@ -141,12 +164,18 @@ var messageHandler = (function(my) {
* @param title the title of the message * @param title the title of the message
* @param message the text of the messafe * @param message the text of the messafe
*/ */
my.showError = function(title, message) { my.showError = function(titleKey, title, msgKey, message) {
if(!(title || message)) {
title = title || "Oops!"; if(!titleKey) {
message = message || "There was some kind of error"; 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, my.notify = function(displayName, displayNameKey, displayNameDefault,

View File

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

View File

@ -14,6 +14,7 @@ var defaultOptions = {
detectLngQS: "lang", detectLngQS: "lang",
useCookie: false, useCookie: false,
fallbackLng: DEFAULT_LANG, fallbackLng: DEFAULT_LANG,
shortcutFunction: 'defaultValue',
load: "unspecific", load: "unspecific",
resGetPath: 'lang/__ns__-__lng__.json', resGetPath: 'lang/__ns__-__lng__.json',
ns: { ns: {
@ -82,13 +83,13 @@ module.exports = {
options.lng = lang; options.lng = lang;
i18n.init(options, initCompleted); i18n.init(options, initCompleted);
}, },
translateString: function (key, cb, defaultValue) { translateString: function (key, cb, options) {
if(!cb) if(!cb)
return i18n.t(key, defaultValue); return i18n.t(key, options);
if(initialized) if(initialized)
{ {
cb(i18n.t(key, defaultValue)); cb(i18n.t(key, options));
} }
else else
{ {
@ -106,5 +107,23 @@ module.exports = {
}, },
translateElement: function (selector) { translateElement: function (selector) {
selector.i18n(); 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;
} }
}; };

View File

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

View File

@ -271,21 +271,26 @@ module.exports = function(XMPP, eventEmitter) {
// We're either missing Jicofo/Prosody config for anonymous // We're either missing Jicofo/Prosody config for anonymous
// domains or something is wrong. // domains or something is wrong.
// XMPP.promptLogin(); // XMPP.promptLogin();
APP.UI.messageHandler.openReportDialog(null, APP.UI.messageHandler.openReportDialog(null, null,
"dialog.joinError",
'Oops ! We couldn`t join the conference.' + 'Oops ! We couldn`t join the conference.' +
' There might be some problem with security' + ' There might be some problem with security' +
' configuration. Please contact service' + ' configuration. Please contact service' +
' administrator.', pres); ' administrator.', pres);
} else { } else {
console.warn('onPresError ', pres); console.warn('onPresError ', pres);
APP.UI.messageHandler.openReportDialog(null, APP.UI.messageHandler.openReportDialog(null, null,
'Oops! Something went wrong and we couldn`t connect to the conference.', "dialog.connectError",
'Oops! Something went wrong and we couldn`t ' +
'connect to the conference.',
pres); pres);
} }
} else { } else {
console.warn('onPresError ', pres); console.warn('onPresError ', pres);
APP.UI.messageHandler.openReportDialog(null, APP.UI.messageHandler.openReportDialog(null, null,
'Oops! Something went wrong and we couldn`t connect to the conference.', "dialog.connectError",
'Oops! Something went wrong and we couldn`t ' +
'connect to the conference.',
pres); pres);
} }
return true; return true;

View File

@ -252,8 +252,8 @@ var XMPP = {
} else { } else {
// We are done immediately // We are done immediately
console.error("No conference handler"); console.error("No conference handler");
APP.UI.messageHandler.showError('Error', APP.UI.messageHandler.showError("dialog.error", 'Error',
'Unable to switch video stream.'); "dialog.unableToSwitch", 'Unable to switch video stream.');
callback(); callback();
} }
}, },
@ -314,7 +314,8 @@ var XMPP = {
}, },
function (error) { function (error) {
console.log('mute SLD error'); console.log('mute SLD error');
APP.UI.messageHandler.showError('Error', APP.UI.messageHandler.showError("dialog.error",
'Error', "dialog.SLDFailure",
'Oops! Something went wrong and we failed to ' + 'Oops! Something went wrong and we failed to ' +
'mute! (SLD Failure)'); 'mute! (SLD Failure)');
} }
@ -328,7 +329,8 @@ var XMPP = {
}, },
function (error) { function (error) {
console.log('muteVideo SRD error'); console.log('muteVideo SRD error');
APP.UI.messageHandler.showError('Error', APP.UI.messageHandler.showError("dialog.error", 'Error',
"dialog.SRDFailure",
'Oops! Something went wrong and we failed to stop video!' + 'Oops! Something went wrong and we failed to stop video!' +
'(SRD Failure)'); '(SRD Failure)');