From b5f0d3029836208ea820ffc283070553ed577915 Mon Sep 17 00:00:00 2001 From: damencho Date: Mon, 17 Oct 2016 17:33:30 -0500 Subject: [PATCH 01/13] Removes not used parameter of openMessageDialog (title). We pass key which is enough to obtain the title. --- conference.js | 2 +- modules/UI/UI.js | 2 -- modules/UI/recording/Recording.js | 4 ++-- modules/UI/shared_video/SharedVideo.js | 2 +- modules/UI/util/MessageHandler.js | 9 ++------- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/conference.js b/conference.js index 9f892d642..de26abedc 100644 --- a/conference.js +++ b/conference.js @@ -195,7 +195,7 @@ function maybeRedirectToWelcomePage(showThankYou) { if (showThankYou) { APP.UI.messageHandler.openMessageDialog( - null, null, null, + null, null, APP.translation.translateString( "dialog.thankYou", {appName:interfaceConfig.APP_NAME} ) diff --git a/modules/UI/UI.js b/modules/UI/UI.js index d132e6b9f..da6b3d0d1 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -1219,7 +1219,6 @@ UI.showExtensionRequiredDialog = function (url) { messageHandler.openMessageDialog( "dialog.extensionRequired", null, - null, APP.translation.generateTranslationHTML( "dialog.firefoxExtensionPrompt", {url: url})); }; @@ -1397,7 +1396,6 @@ UI.showTrackNotWorkingDialog = function (stream) { "dialog.error", stream.isAudioTrack()? "dialog.micNotSendingData" : "dialog.cameraNotSendingData", - null, null); }; diff --git a/modules/UI/recording/Recording.js b/modules/UI/recording/Recording.js index 2b82c326b..f218a9f3c 100644 --- a/modules/UI/recording/Recording.js +++ b/modules/UI/recording/Recording.js @@ -365,7 +365,7 @@ var Recording = { dialog = APP.UI.messageHandler.openMessageDialog( self.recordingTitle, self.recordingBusy, - null, null, + null, function () { dialog = null; } @@ -376,7 +376,7 @@ var Recording = { dialog = APP.UI.messageHandler.openMessageDialog( self.recordingTitle, self.recordingUnavailable, - null, null, + null, function () { dialog = null; } diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js index 36482e63e..c8a7a58b8 100644 --- a/modules/UI/shared_video/SharedVideo.js +++ b/modules/UI/shared_video/SharedVideo.js @@ -93,7 +93,7 @@ export default class SharedVideoManager { dialog = APP.UI.messageHandler.openMessageDialog( "dialog.shareVideoTitle", "dialog.alreadySharedVideoMsg", - null, null, + null, function () { dialog = null; } diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.js index 319a459e3..6955c16e4 100644 --- a/modules/UI/util/MessageHandler.js +++ b/modules/UI/util/MessageHandler.js @@ -31,22 +31,17 @@ var messageHandler = { * message, if a message title is not provided. * @param messageKey the key used to find the translation of the message, * if a message is not provided. - * @param title the title of the message. If a falsy value is provided, - * titleKey will be used to get a title via the translation API. * @param message the message to show. If a falsy value is provided, * messageKey will be used to get a message via the translation API. * @param closeFunction function to be called after * the prompt is closed (optional) * @return the prompt that was created, or null */ - openMessageDialog: function(titleKey, messageKey, title, message, - closeFunction) { + openMessageDialog: function(titleKey, messageKey, message, closeFunction) { if (!popupEnabled) return null; - if (!title) { - title = APP.translation.generateTranslationHTML(titleKey); - } + let title = APP.translation.generateTranslationHTML(titleKey); if (!message) { message = APP.translation.generateTranslationHTML(messageKey); } From f0ac52614b4d0592e43867193b17780f7c98a743 Mon Sep 17 00:00:00 2001 From: damencho Date: Mon, 17 Oct 2016 17:43:57 -0500 Subject: [PATCH 02/13] Removes title param from openTwoButtonDialog. --- modules/UI/UI.js | 3 --- modules/UI/toolbars/Toolbar.js | 2 -- modules/UI/util/MessageHandler.js | 9 +++------ 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/modules/UI/UI.js b/modules/UI/UI.js index da6b3d0d1..56db454f2 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -770,7 +770,6 @@ UI.connectionIndicatorShowMore = function(id) { UI.showLoginPopup = function(callback) { console.log('password is required'); let titleKey = "dialog.passwordRequired"; - let titleString = APP.translation.translateString(titleKey); let message = ( ` @@ -287,7 +286,6 @@ function showSipNumberInput () { APP.UI.messageHandler.openTwoButtonDialog({ titleKey, - titleString: sipMsg, msgString, leftButtonKey: "dialog.Dial", submitFunction: function (e, v, m, f) { diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.js index 6955c16e4..f5b4b2572 100644 --- a/modules/UI/util/MessageHandler.js +++ b/modules/UI/util/MessageHandler.js @@ -61,7 +61,7 @@ var messageHandler = { * Shows a message to the user with two buttons: first is given as a * parameter and the second is Cancel. * - * @param titleString the title of the message + * @param titleKey the key for the title of the message * @param msgString the text of the message * @param persistent boolean value which determines whether the message is * persistent or not @@ -79,7 +79,6 @@ var messageHandler = { openTwoButtonDialog: function(options) { let { titleKey, - titleString, msgKey, msgString, leftButtonKey, @@ -107,10 +106,8 @@ var messageHandler = { = APP.translation.generateTranslationHTML("dialog.Cancel"); buttons.push({title: cancelButton, value: false}); - var message = msgString, title = titleString; - if (titleKey) { - title = APP.translation.generateTranslationHTML(titleKey); - } + var message = msgString; + var title = APP.translation.generateTranslationHTML(titleKey); if (msgKey) { message = APP.translation.generateTranslationHTML(msgKey); } From 65f8c9ad97ef02eccbf3b31acb2674ff69667d5e Mon Sep 17 00:00:00 2001 From: damencho Date: Mon, 17 Oct 2016 18:11:48 -0500 Subject: [PATCH 03/13] Removes title param from openTwoButtonDialog. --- conference.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conference.js b/conference.js index de26abedc..af902558c 100644 --- a/conference.js +++ b/conference.js @@ -195,7 +195,7 @@ function maybeRedirectToWelcomePage(showThankYou) { if (showThankYou) { APP.UI.messageHandler.openMessageDialog( - null, null, + null, "dialog.thankYou", APP.translation.translateString( "dialog.thankYou", {appName:interfaceConfig.APP_NAME} ) From 0455c26fb2de407f5009ee47a1d4811a1d77fdb7 Mon Sep 17 00:00:00 2001 From: damencho Date: Mon, 17 Oct 2016 18:14:38 -0500 Subject: [PATCH 04/13] Uses titleKey to generate title string containing data-i18n attribute. --- modules/UI/UI.js | 15 ++++++------- modules/UI/authentication/LoginDialog.js | 4 ++-- modules/UI/invite/InviteDialogView.js | 24 ++++++++++----------- modules/UI/util/MessageHandler.js | 27 +++++++++++------------- 4 files changed, 31 insertions(+), 39 deletions(-) diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 56db454f2..2e5288f2d 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -76,12 +76,11 @@ JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NO_DATA_FROM_SOURCE] function promptDisplayName() { let labelKey = 'dialog.enterDisplayName'; let labelStr = APP.translation.translateString(labelKey); - let titleStr - = APP.translation.translateString('dialog.displayNameRequired'); let defaultNickMsg = APP.translation.translateString("defaultNickname"); let message = ( `
- +
', buttons: [], defaultButton: 0 }, finished: { - title: APP.translation.translateString('dialog.error'), + titleKey: 'dialog.error', html: '
', buttons: finishedButtons, defaultButton: 0, diff --git a/modules/UI/invite/InviteDialogView.js b/modules/UI/invite/InviteDialogView.js index 8f19dd771..03057aeee 100644 --- a/modules/UI/invite/InviteDialogView.js +++ b/modules/UI/invite/InviteDialogView.js @@ -15,8 +15,8 @@ const States = { */ export default class InviteDialogView { constructor(model) { - let InviteAttributesKey = 'inviteUrlDefaultMsg'; - let title = APP.translation.translateString(InviteAttributesKey); + let inviteAttributesKey = 'inviteUrlDefaultMsg'; + let title = APP.translation.translateString(inviteAttributesKey); this.unlockHint = "unlockHint"; this.lockHint = "lockHint"; @@ -24,7 +24,7 @@ export default class InviteDialogView { if (this.model.inviteUrl === null) { this.inviteAttributes = ( - `data-i18n="[value]inviteUrlDefaultMsg" value="${title}"` + `data-i18n="[value]${inviteAttributesKey}" value="${title}"` ); } else { let encodedInviteUrl = this.model.getEncodedInviteUrl(); @@ -43,11 +43,7 @@ export default class InviteDialogView { dialog.submitFunction = this.submitFunction.bind(this); dialog.loadedFunction = this.loadedFunction.bind(this); - let titleKey = "dialog.shareLink"; - let titleString = APP.translation.generateTranslationHTML(titleKey); - - dialog.titleKey = titleKey; - dialog.titleString = titleString; + dialog.titleKey = "dialog.shareLink"; this.dialog = dialog; this.dialog.states = this.getStates(); @@ -101,7 +97,7 @@ export default class InviteDialogView { */ getStates() { let { - titleString + titleKey } = this.dialog; let doneKey = 'dialog.done'; let doneMsg = APP.translation.translateString(doneKey); @@ -110,12 +106,12 @@ export default class InviteDialogView { buttons[`${doneMsg}`] = true; states[States.UNLOCKED] = { - title: titleString, + titleKey, html: this.getShareLinkBlock() + this.getAddPasswordBlock(), buttons }; states[States.LOCKED] = { - title: titleString, + titleKey, html: this.getShareLinkBlock() + this.getPasswordBlock(), buttons }; @@ -135,10 +131,12 @@ export default class InviteDialogView { let roomUnlockKey = 'roomUnlocked'; let roomUnlock = APP.translation.translateString(roomUnlockKey); let classes = 'button-control button-control_light copyInviteLink'; + let title = APP.translation.translateString(this.dialog.titleKey); return ( `
-

"; } if (this.showMoreValue) { @@ -139,8 +132,7 @@ ConnectionIndicator.prototype.generateText = function () { if (!this.transport || this.transport.length === 0) { transport = "" + "" + - translate("connectionindicator.address") + "" + + "data-i18n='connectionindicator.address'>" + " N/A"; } else { var data = {remoteIP: [], localIP:[], remotePort:[], localPort:[]}; @@ -173,18 +165,13 @@ ConnectionIndicator.prototype.generateText = function () { var localTransport = "" + - translate(local_address_key, {count: data.localIP.length}) + - " " + + JSON.stringify({count: data.localIP.length}) + "'> " + ConnectionIndicator.getStringFromArray(data.localIP) + ""; transport = "" + - translate(remote_address_key, - {count: data.remoteIP.length}) + - " " + + JSON.stringify({count: data.remoteIP.length}) + "'> " + ConnectionIndicator.getStringFromArray(data.remoteIP) + ""; @@ -195,16 +182,12 @@ ConnectionIndicator.prototype.generateText = function () { "" + "" + - translate(key_remote, {count: this.transport.length}) + - ""; + JSON.stringify({count: this.transport.length}) + "'>"; localTransport += "" + "" + "" + - translate(key_local, {count: this.transport.length}) + - ""; + JSON.stringify({count: this.transport.length}) + "'>"; transport += ConnectionIndicator.getStringFromArray(data.remotePort); @@ -213,8 +196,7 @@ ConnectionIndicator.prototype.generateText = function () { transport += ""; transport += localTransport + ""; transport +="" + - "" + - translate("connectionindicator.transport") + "" + + "" + "" + this.transport[0].type + ""; } @@ -222,8 +204,7 @@ ConnectionIndicator.prototype.generateText = function () { result += "" + "" + "
" + - "" + - 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 = " Date: Fri, 21 Oct 2016 22:10:33 -0500 Subject: [PATCH 09/13] Updates openMessageDialog to get only key and options. --- conference.js | 5 ++--- modules/UI/UI.js | 11 ++++------- modules/UI/util/MessageHandler.js | 18 +++++++----------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/conference.js b/conference.js index 2c722bcf2..3ee6524d8 100644 --- a/conference.js +++ b/conference.js @@ -194,9 +194,8 @@ function maybeRedirectToWelcomePage(showThankYou) { } if (showThankYou) { - APP.UI.messageHandler.openMessageDialog(null, null, - APP.translation.generateTranslationHTML( - "dialog.thankYou", {appName:interfaceConfig.APP_NAME})); + APP.UI.messageHandler.openMessageDialog( + null, "dialog.thankYou", {appName:interfaceConfig.APP_NAME}); } if (!config.enableWelcomePage) { diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 5b629b554..b461c1590 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -1051,7 +1051,7 @@ UI.updateDTMFSupport = function (isDTMFSupported) { * @returns {Promise} Resolved with value - false if the dialog is enabled and * resolved with true if the dialog is disabled or the feedback was already * submitted. Rejected if another dialog is already displayed. This values are - * used to display or not display the thank you dialog from + * used to display or not display the thank you dialog from * conference.maybeRedirectToWelcomePage method. */ UI.requestFeedbackOnHangup = function () { @@ -1207,9 +1207,8 @@ UI.getLargeVideo = function () { UI.showExtensionRequiredDialog = function (url) { messageHandler.openMessageDialog( "dialog.extensionRequired", - null, - APP.translation.generateTranslationHTML( - "dialog.firefoxExtensionPrompt", {url: url})); + "dialog.firefoxExtensionPrompt", + {url: url}); }; /** @@ -1232,7 +1231,6 @@ UI.showExtensionExternalInstallationDialog = function (url) { messageHandler.openTwoButtonDialog({ titleKey: 'dialog.externalInstallationTitle', msgKey: 'dialog.externalInstallationMsg', - msgString: '', leftButtonKey: 'dialog.goToStore', submitFunction, loadedFunction: $.noop, @@ -1379,8 +1377,7 @@ UI.showTrackNotWorkingDialog = function (stream) { messageHandler.openMessageDialog( "dialog.error", stream.isAudioTrack()? "dialog.micNotSendingData" : - "dialog.cameraNotSendingData", - null); + "dialog.cameraNotSendingData"); }; UI.updateDevicesAvailability = function (id, devices) { diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.js index dfe0fae81..114418a75 100644 --- a/modules/UI/util/MessageHandler.js +++ b/modules/UI/util/MessageHandler.js @@ -29,23 +29,19 @@ var messageHandler = { * * @param titleKey the key used to find the translation of the title of the * message, if a message title is not provided. - * @param messageKey the key used to find the translation of the message, - * if a message is not provided. - * @param message the message to show. If a falsy value is provided, - * messageKey will be used to get a message via the translation API. + * @param messageKey the key used to find the translation of the message + * @param i18nOptions the i18n options (optional) * @param closeFunction function to be called after * the prompt is closed (optional) * @return the prompt that was created, or null */ - openMessageDialog: function(titleKey, messageKey, message, closeFunction) { + openMessageDialog: + function(titleKey, messageKey, i18nOptions, closeFunction) { if (!popupEnabled) return null; - if (!message) { - message = APP.translation.generateTranslationHTML(messageKey); - } - - let dialog = $.prompt(message, { + let dialog = $.prompt( + APP.translation.generateTranslationHTML(messageKey, i18nOptions), { title: this._getFormattedTitleString(titleKey), persistent: false, promptspeed: 0, @@ -55,7 +51,7 @@ var messageHandler = { closeFunction(e, v, m, f); } }); - APP.translation.translateElement(dialog); + APP.translation.translateElement(dialog, i18nOptions); return dialog; }, /** From 8a789aa608a93bce891034448c5b9708a552955e Mon Sep 17 00:00:00 2001 From: damencho Date: Fri, 21 Oct 2016 23:39:32 -0500 Subject: [PATCH 10/13] Fixes some translations. --- index.html | 6 +++--- lang/main.json | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 155c12aef..2e1be2b35 100644 --- a/index.html +++ b/index.html @@ -105,7 +105,7 @@
- + @@ -138,11 +138,11 @@
- +
- +

diff --git a/lang/main.json b/lang/main.json index 776b5fae5..860483b3d 100644 --- a/lang/main.json +++ b/lang/main.json @@ -99,6 +99,7 @@ "cameraDisabled": "Camera is not available", "micDisabled": "Microphone is not available", "filmstrip": "Show / hide videos", + "profile": "Edit your profile", "raiseHand": "Raise hand to speak" }, "bottomtoolbar": { @@ -135,7 +136,8 @@ "profile": { "title": "Profile", "setDisplayNameLabel": "Set your display name", - "setEmailLabel": "Set your gravatar email" + "setEmailLabel": "Set your gravatar email", + "setEmailInput": "Enter e-mail" }, "videothumbnail": { From 076f7a82de86f343475372ce80a6c6ef620691b7 Mon Sep 17 00:00:00 2001 From: damencho Date: Mon, 24 Oct 2016 14:42:23 -0500 Subject: [PATCH 11/13] Updates translation readme. --- lang/readme.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lang/readme.md b/lang/readme.md index 2911c3412..e9b8ca244 100644 --- a/lang/readme.md +++ b/lang/readme.md @@ -1,20 +1,20 @@ Jitsi Meet Translation ========================== -Jitsi Meet uses [i18next](http://i18next.com) library for translation. -i18next uses separate json files for each language. +Jitsi Meet uses [i18next](http://i18next.com) library for translation. +i18next uses separate json files for each language. Translating Jitsi Meet ====================== -The translation of Jitsi Meet is integrated with Pootle. You can translate Jitsi Meet via our Pootle user interface on -[http://translate.jitsi.org](http://translate.jitsi.org). +The translation of Jitsi Meet is integrated with Pootle. You can translate Jitsi Meet via our Pootle user interface on +[http://translate.jitsi.org](http://translate.jitsi.org). **WARNING: Please don't create or edit manually the language files! Please use our Pootle user interface!** Development =========== If you want to add new functionality for Jitsi Meet and you have texts that need to be translated please use our translation module. -It is located in modules/translation. You must add key and value in main.json file in English for each translatable text. +It is located in modules/translation. You must add key and value in main.json file in English for each translatable text. Than you can use the key to get the translated text for the current language. **WARNING: Please don't change the other language files except main.json! They must be updated and translated via our Pootle user interface!** @@ -36,21 +36,19 @@ You can add translatable text in the HTML: ``` APP.translation.generateTranslationHTML("dialog.OK") // returns OK ``` - + The value in the options parameter will be added in data-i18n-options attribute of the element. - + **Note:** If you dynamically add HTML elements don't forget to call APP.translation.translateElement(jquery_selector) to translate the text initially. -* **via Javascript string** - call APP.translation.translateString(key, options). You can use that method to get the translated string in Javascript and then attach it in the HTML. - + ``` - APP.translation.translateString("dialog.OK") // returns the value for the key of the current language file. "OK" for example. + APP.translation.translateString("dialog.OK") // returns the value for the key of the current language file. "OK" for example. ``` -For the available values of ``options`` parameter for the above methods of translation module see [i18next documentation](http://i18next.com/pages/doc_features). +For the available values of ``options`` parameter for the above methods of translation module see [i18next documentation](http://i18next.com/pages/doc_features). **Note:** It is useful to add attributes in the HTML for persistent HTML elements because when the language is changed the text will be automatically translated. - Otherwise you should call ``APP.translation.translateString`` and manually change the text every time the language is changed. From b2a1c9881ed91b8c5a005d59d69e0eff6ef42e90 Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 25 Oct 2016 15:18:56 -0500 Subject: [PATCH 12/13] Fixes comments from review. Adds a safe check, i18n is expecting undefined not null. Fix a method name and translation to be at placeholder. --- modules/UI/feedback/FeedbackWindow.js | 4 ++-- modules/UI/invite/InviteDialogView.js | 3 ++- modules/translation/translation.js | 7 +++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/UI/feedback/FeedbackWindow.js b/modules/UI/feedback/FeedbackWindow.js index 1bf248a44..f6254557e 100644 --- a/modules/UI/feedback/FeedbackWindow.js +++ b/modules/UI/feedback/FeedbackWindow.js @@ -146,10 +146,10 @@ export default class Dialog { this.submitted = false; this.onCloseCallback = function() {}; - this.setDefaulOptions(); + this.setDefaultOptions(); } - setDefaulOptions() { + setDefaultOptions() { var self = this; this.options = { diff --git a/modules/UI/invite/InviteDialogView.js b/modules/UI/invite/InviteDialogView.js index 74e62e6ce..95ee622b6 100644 --- a/modules/UI/invite/InviteDialogView.js +++ b/modules/UI/invite/InviteDialogView.js @@ -156,7 +156,8 @@ export default class InviteDialogView {
+ type="text" + data-i18n="[placeholder]dialog.createPassword">