diff --git a/conference.js b/conference.js index af902558c..75e5c9e5f 100644 --- a/conference.js +++ b/conference.js @@ -194,12 +194,9 @@ function maybeRedirectToWelcomePage(showThankYou) { } if (showThankYou) { - APP.UI.messageHandler.openMessageDialog( - null, "dialog.thankYou", - APP.translation.translateString( - "dialog.thankYou", {appName:interfaceConfig.APP_NAME} - ) - ); + APP.UI.messageHandler.openMessageDialog(null, null, + APP.translation.generateTranslationHTML( + "dialog.thankYou", {appName:interfaceConfig.APP_NAME})); } if (!config.enableWelcomePage) { @@ -1050,21 +1047,20 @@ export default { // TrackErrors.GENERAL // and any other let dialogTxt; - let dialogTitle; + let dialogTitleKey; if (err.name === TrackErrors.PERMISSION_DENIED) { dialogTxt = APP.translation.generateTranslationHTML( "dialog.screenSharingPermissionDeniedError"); - dialogTitle = APP.translation.generateTranslationHTML( - "dialog.error"); + dialogTitleKey = "dialog.error"; } else { dialogTxt = APP.translation.generateTranslationHTML( "dialog.failtoinstall"); - dialogTitle = APP.translation.generateTranslationHTML( - "dialog.permissionDenied"); + dialogTitleKey = "dialog.permissionDenied"; } - APP.UI.messageHandler.openDialog(dialogTitle, dialogTxt, false); + APP.UI.messageHandler.openDialog( + dialogTitleKey, dialogTxt, false); }); } else { createLocalTracks({ devices: ['video'] }).then( diff --git a/index.html b/index.html index 46462e14b..9895f86c9 100644 --- a/index.html +++ b/index.html @@ -174,7 +174,7 @@
- ${roomLockDesc} +
- ${roomUnlock} +
- ${currentPassText} +
+ ${password} @@ -225,9 +194,7 @@ export default class InviteDialogView {
- ${removePassText} - + data-i18n="dialog.removePassword">- ${description} +
`; }, /** @@ -198,6 +191,7 @@ var ContactListView = { createDisplayNameParagraph( isLocal ? interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME : null, isLocal ? null : interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME)); + APP.translation.translateElement($(newContact)); if (APP.conference.isLocalId(id)) { contactlist.prepend(newContact); diff --git a/modules/UI/util/JitsiPopover.js b/modules/UI/util/JitsiPopover.js index f99d57747..f8addfee5 100644 --- a/modules/UI/util/JitsiPopover.js +++ b/modules/UI/util/JitsiPopover.js @@ -1,4 +1,4 @@ -/* global $ */ +/* global $, APP */ var JitsiPopover = (function () { /** * Constructs new JitsiPopover and attaches it to the element @@ -76,7 +76,9 @@ var JitsiPopover = (function () { */ JitsiPopover.prototype.createPopover = function () { $("body").append(this.template); - $(".jitsipopover > .jitsipopover-content").html(this.options.content); + let popoverElem = $(".jitsipopover > .jitsipopover-content"); + popoverElem.html(this.options.content); + APP.translation.translateElement(popoverElem); var self = this; $(".jitsipopover").on("mouseenter", function () { self.popoverIsHovered = true; diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.js index 3ee8afd2a..dfe0fae81 100644 --- a/modules/UI/util/MessageHandler.js +++ b/modules/UI/util/MessageHandler.js @@ -45,7 +45,7 @@ var messageHandler = { message = APP.translation.generateTranslationHTML(messageKey); } - return $.prompt(message, { + let dialog = $.prompt(message, { title: this._getFormattedTitleString(titleKey), persistent: false, promptspeed: 0, @@ -55,6 +55,8 @@ var messageHandler = { closeFunction(e, v, m, f); } }); + APP.translation.translateElement(dialog); + return dialog; }, /** * Shows a message to the user with two buttons: first is given as a @@ -137,6 +139,7 @@ var messageHandler = { } } }); + APP.translation.translateElement(twoButtonDialog); return twoButtonDialog; }, @@ -177,7 +180,9 @@ var messageHandler = { args.closeText = ''; } - return new Impromptu(msgString, args); + let dialog = new Impromptu(msgString, args); + APP.translation.translateElement(dialog.getPrompt()); + return dialog; }, /** @@ -189,7 +194,6 @@ var messageHandler = { let $titleString = $('" + - translate("connectionindicator.bitrate") + " | " + + "" + " | ↓" + downloadBitrate + " ↑" + uploadBitrate + " | " + "
" + - translate("connectionindicator.packetloss") + " | " + + "" + " | " + packetLoss + " | " + "
" + - translate("connectionindicator.resolution") + " | " + + "" + " | " + resolutionStr + " |
" + - "" + - translate("connectionindicator.bandwidth") + "" + + "" + " | " +
"↓" +
downloadBandwidth +
@@ -266,8 +247,7 @@ ConnectionIndicator.prototype.create = function () {
this.connectionIndicatorContainer);
this.popover = new JitsiPopover(
$("#" + this.videoContainer.videoSpanId + " > .connectionindicator"),
- {content: " " +
- APP.translation.translateString("connectionindicator.na") + " ",
+ {content: "",
skin: "black"});
// override popover show method to make sure we will update the content
@@ -381,7 +361,6 @@ ConnectionIndicator.prototype.updatePopoverData = function (force) {
this.popover.updateContent(
`${this.generateText()} `
);
- APP.translation.translateElement($(".connection_info"));
}
};
diff --git a/modules/UI/videolayout/LargeVideoManager.js b/modules/UI/videolayout/LargeVideoManager.js
index 4b2217512..2ce6fa080 100644
--- a/modules/UI/videolayout/LargeVideoManager.js
+++ b/modules/UI/videolayout/LargeVideoManager.js
@@ -379,9 +379,10 @@ export default class LargeVideoManager {
*/
_setRemoteConnectionMessage (msgKey, msgOptions) {
if (msgKey) {
- let text = APP.translation.translateString(msgKey, msgOptions);
$('#remoteConnectionMessage')
- .attr("data-i18n", msgKey).text(text);
+ .attr("data-i18n", msgKey)
+ .attr("data-i18n-options", JSON.stringify(msgOptions));
+ APP.translation.translateElement($('#remoteConnectionMessage'));
}
this.videoContainer.positionRemoteConnectionMessage();
@@ -400,7 +401,8 @@ export default class LargeVideoManager {
_setLocalConnectionMessage (msgKey, msgOptions) {
$('#localConnectionMessage')
.attr("data-i18n", msgKey)
- .text(APP.translation.translateString(msgKey, msgOptions));
+ .attr("data-i18n-options", JSON.stringify(msgOptions));
+ APP.translation.translateElement($('#localConnectionMessage'));
}
/**
diff --git a/modules/UI/videolayout/LocalVideo.js b/modules/UI/videolayout/LocalVideo.js
index 9cb7456cc..0aadf0e81 100644
--- a/modules/UI/videolayout/LocalVideo.js
+++ b/modules/UI/videolayout/LocalVideo.js
@@ -96,14 +96,12 @@ LocalVideo.prototype.setDisplayName = function(displayName) {
editableText.value = displayName;
}
- var defaultNickname = APP.translation.translateString(
- "defaultNickname", {name: "Jane Pink"});
editableText.setAttribute('style', 'display:none;');
- editableText.setAttribute('data-18n',
+ editableText.setAttribute('data-i18n',
'[placeholder]defaultNickname');
editableText.setAttribute("data-i18n-options",
JSON.stringify({name: "Jane Pink"}));
- editableText.setAttribute("placeholder", defaultNickname);
+ APP.translation.translateElement($(editableText));
this.container
.querySelector('.videocontainer__toolbar')
@@ -253,7 +251,8 @@ LocalVideo.prototype._buildContextMenu = function () {
events: {
show : function(options){
options.items.flip.name =
- APP.translation.translateString("videothumbnail.flip");
+ APP.translation.generateTranslationHTML(
+ "videothumbnail.flip");
}
}
});
diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js
index 6749de3af..481afd520 100644
--- a/modules/UI/videolayout/RemoteVideo.js
+++ b/modules/UI/videolayout/RemoteVideo.js
@@ -109,16 +109,10 @@ RemoteVideo.prototype._generatePopupContent = function () {
var mutedIndicator = "";
var doMuteHTML = mutedIndicator +
- " " +
- APP.translation.translateString("videothumbnail.domute") +
- " ";
+ " ";
var mutedHTML = mutedIndicator +
- " " +
- APP.translation.translateString("videothumbnail.muted") +
- " ";
+ " ";
muteLinkItem.id = "mutelink_" + this.id;
@@ -150,10 +144,7 @@ RemoteVideo.prototype._generatePopupContent = function () {
var ejectMenuItem = document.createElement('li');
var ejectLinkItem = document.createElement('a');
- var ejectText = "" +
- APP.translation.translateString("videothumbnail.kick") +
- " ";
+ var ejectText = "";
ejectLinkItem.className = 'ejectlink';
ejectLinkItem.innerHTML = ejectIndicator + ' ' + ejectText;
@@ -167,6 +158,8 @@ RemoteVideo.prototype._generatePopupContent = function () {
ejectMenuItem.appendChild(ejectLinkItem);
popupmenuElement.appendChild(ejectMenuItem);
+ APP.translation.translateElement($(popupmenuElement));
+
return popupmenuElement;
};
diff --git a/modules/keyboardshortcut/keyboardshortcut.js b/modules/keyboardshortcut/keyboardshortcut.js
index 6918c32f6..8b51774a3 100644
--- a/modules/keyboardshortcut/keyboardshortcut.js
+++ b/modules/keyboardshortcut/keyboardshortcut.js
@@ -190,8 +190,7 @@ var KeyboardShortcut = {
let descriptionClass = "shortcuts-list__description";
descriptionElement.className = descriptionClass;
descriptionElement.setAttribute("data-i18n", shortcutDescriptionKey);
- descriptionElement.innerHTML
- = APP.translation.translateString(shortcutDescriptionKey);
+ APP.translation.translateElement($(descriptionElement));
listElement.appendChild(spanElement);
listElement.appendChild(descriptionElement);
diff --git a/modules/translation/translation.js b/modules/translation/translation.js
index b799e5086..b0db06a33 100644
--- a/modules/translation/translation.js
+++ b/modules/translation/translation.js
@@ -89,9 +89,6 @@ module.exports = {
i18n.init(options, initCompleted);
},
- translateString: function (key, options) {
- return i18n.t(key, options);
- },
setLanguage: function (lang) {
if(!lang)
lang = DEFAULT_LANG;
@@ -100,16 +97,16 @@ module.exports = {
getCurrentLanguage: function () {
return i18n.lng();
},
- translateElement: function (selector) {
- selector.i18n();
+ translateElement: function (selector, options) {
+ selector.i18n(options);
},
generateTranslationHTML: function (key, options) {
var str = "";
- str += this.translateString(key, options);
+ str += i18n.t(key, options);
str += "";
return str;
|