From d2f95f3c813321404bd2f108f2599b31742584cc Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Mon, 9 Mar 2015 17:50:13 +0200 Subject: [PATCH] Fixes some translation issues. --- Makefile | 2 +- app.js | 1 + config.js | 18 +++-- css/jitsi_popover.css | 2 + css/settingsmenu.css | 4 +- index.html | 2 +- interface_config.js | 2 +- lang/main.json | 17 ++++- modules/UI/UI.js | 7 +- modules/UI/prezi/Prezi.js | 7 +- .../side_pannels/contactlist/ContactList.js | 12 ++- modules/UI/toolbars/Toolbar.js | 35 ++++----- modules/UI/videolayout/VideoLayout.js | 74 ++++++++++++++----- 13 files changed, 118 insertions(+), 65 deletions(-) diff --git a/Makefile b/Makefile index ffa86cc26..f06b20d03 100644 --- a/Makefile +++ b/Makefile @@ -21,4 +21,4 @@ clean: deploy: @mkdir -p $(DEPLOY_DIR) && cp $(OUTPUT_DIR)/*.bundle.js $(DEPLOY_DIR) - + scp $(DEPLOY_DIR)/app.bundle.js hristo.jitsi.net:/srv/web/hristo.jitsi.net/$(DEPLOY_DIR) diff --git a/app.js b/app.js index a28b40420..23d5b2369 100644 --- a/app.js +++ b/app.js @@ -14,6 +14,7 @@ var APP = this.xmpp = require("./modules/xmpp/xmpp"); this.keyboardshortcut = require("./modules/keyboardshortcut/keyboardshortcut"); this.translation = require("./modules/translation/translation"); + this.settings = require("./modules/settings/Settings"); } }; diff --git a/config.js b/config.js index 613c7eed7..c96c985fa 100644 --- a/config.js +++ b/config.js @@ -1,9 +1,10 @@ var config = { hosts: { - domain: 'jitsi-meet.example.com', + domain: 'hristo.jitsi.net', //anonymousdomain: 'guest.example.com', - muc: 'conference.jitsi-meet.example.com', // FIXME: use XEP-0030 - bridge: 'jitsi-videobridge.jitsi-meet.example.com', // FIXME: use XEP-0030 +// anonymousdomain: 'guest.hristo.jitsi.net', + muc: 'conference.hristo.jitsi.net', // FIXME: use XEP-0030 + bridge: 'jitsi-videobridge.hristo.jitsi.net', // FIXME: use XEP-0030 //jirecon: 'jirecon.jitsi-meet.example.com', //call_control: 'callcontrol.jitsi-meet.example.com', //focus: 'focus.jitsi-meet.example.com' - defaults to 'focus.jitsi-meet.example.com' @@ -12,11 +13,12 @@ var config = { // useStunTurn: true, // use XEP-0215 to fetch STUN and TURN server // useIPv6: true, // ipv6 support. use at your own risk useNicks: false, - bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that + bosh: '//hristo.jitsi.net/http-bind', // FIXME: use xep-0156 for that clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza //focusUserJid: 'focus@auth.jitsi-meet.example.com', // The real JID of focus participant - can be overridden here - //defaultSipNumber: '', // Default SIP number + defaultSipNumber: '123', // Default SIP number desktopSharing: 'ext', // Desktop sharing method. Can be set to 'ext', 'webrtc' or false to disable. +// resolution: "1080", chromeExtensionId: 'diibjkoicjeejcmhdnailmkgecihlobk', // Id of desktop streamer Chrome extension desktopSharingSources: ['screen', 'window'], minChromeExtVersion: '0.1', // Required version of Chrome extension @@ -26,9 +28,9 @@ var config = { channelLastN: -1, // The default value of the channel attribute last-n. adaptiveLastN: false, adaptiveSimulcast: false, - useRtcpMux: true, - useBundle: true, - enableRecording: false, + useRtcpMux: false, + useBundle: false, + enableRecording: true, enableWelcomePage: true, enableSimulcast: false, enableFirefoxSupport: false, //firefox support is still experimental, only one-to-one conferences with chrome focus diff --git a/css/jitsi_popover.css b/css/jitsi_popover.css index 0489dd217..545ebf1c4 100644 --- a/css/jitsi_popover.css +++ b/css/jitsi_popover.css @@ -99,5 +99,7 @@ width: 90px; height: 16px; padding-top: 4px; + padding-left: 10px; + padding-right: 10px; margin: 15px auto 0px auto; } diff --git a/css/settingsmenu.css b/css/settingsmenu.css index fca0ac3ba..44b29bd05 100644 --- a/css/settingsmenu.css +++ b/css/settingsmenu.css @@ -27,8 +27,8 @@ } #settingsmenu button { - width: 36%; - left: 32%; + width: 45%; + left: 26%; padding: 0; margin-top: 10px; } diff --git a/index.html b/index.html index 35d4a34d1..e6343b4f6 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ - + diff --git a/interface_config.js b/interface_config.js index 78edc9c90..1a2ce9c14 100644 --- a/interface_config.js +++ b/interface_config.js @@ -5,7 +5,7 @@ var interfaceConfig = { INITIAL_TOOLBAR_TIMEOUT: 20000, TOOLBAR_TIMEOUT: 4000, DEFAULT_REMOTE_DISPLAY_NAME: "Fellow Jitster", - DEFAULT_DOMINANT_SPEAKER_DISPLAY_NAME: "Speaker", + DEFAULT_DOMINANT_SPEAKER_DISPLAY_NAME: "speaker", DEFAULT_LOCAL_DISPLAY_NAME: "me", SHOW_JITSI_WATERMARK: true, JITSI_WATERMARK_LINK: "http://jitsi.org", diff --git a/lang/main.json b/lang/main.json index e90f2e05a..d86c659ac 100644 --- a/lang/main.json +++ b/lang/main.json @@ -3,6 +3,12 @@ "connectionsettings": "Connection Settings", "poweredby": "powered by", "downloadlogs": "Download logs", + "roomUrlDefaultMsg": "Your conference is currently being created...", + "participant": "Participant", + "me": "me", + "speaker": "Speaker", + "defaultNickname": "ex. __name__", + "defaultPreziLink": "e.g. __url__", "welcomepage":{ "go": "GO", "roomname": "Enter room name", @@ -60,8 +66,8 @@ }, "bottomtoolbar": { "chat": "Open / close chat", - "filmstrip": "Open / close contact list", - "contactlist": "Show / hide film strip" + "filmstrip": "Show / hide film strip", + "contactlist": "Open / close contact list" }, "chat":{ "nickname": { @@ -182,6 +188,11 @@ "password": "password", "userPassword": "user password", "token": "token" - + }, + "email": + { + "sharedKey": "This conference is password protected. Please use the following pin when joining:%0D%0A%0D%0A __sharedKey__ %0D%0A%0D%0A", + "subject": "Invitation to a __appName__ (__conferenceName__)", + "body": "Hey there, I%27d like to invite you to a __appName__ conference I%27ve just set up.%0D%0A%0D%0APlease click on the following link in order to join the conference.%0D%0A%0D%0A __roomUrl__%0D%0A%0D%0A__sharedKeyText__ Note that __appName__ is currently only supported by Chromium, Google Chrome and Opera, so you need to be using one of these browsers.%0D%0A%0D%0ATalk to you in a sec!" } } diff --git a/modules/UI/UI.js b/modules/UI/UI.js index cdf06de62..d171a12b6 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -393,9 +393,8 @@ function updateChatConversation(from, displayName, message) { function onMucJoined(jid, info) { Toolbar.updateRoomUrl(window.location.href); - document.getElementById('localNick').appendChild( - document.createTextNode(Strophe.getResourceFromJid(jid) + ' (me)') - ); + var meHTML = APP.translation.generateTranslatonHTML("me"); + $("#localNick").html(Strophe.getResourceFromJid(jid) + " (" + meHTML + ")"); var settings = Settings.getSettings(); // Add myself to the contact list. @@ -408,7 +407,7 @@ function onMucJoined(jid, info) { ? info.displayName : Strophe.getResourceFromJid(jid); if (displayName) - onDisplayNameChanged('localVideoContainer', displayName + ' (me)'); + onDisplayNameChanged('localVideoContainer', displayName); } function initEtherpad(name) { diff --git a/modules/UI/prezi/Prezi.js b/modules/UI/prezi/Prezi.js index e0268425b..35f36b316 100644 --- a/modules/UI/prezi/Prezi.js +++ b/modules/UI/prezi/Prezi.js @@ -73,12 +73,15 @@ var Prezi = { buttons1.button2 = {title: backButton, value: true}; var linkError = APP.translation.generateTranslatonHTML( "dialog.preziLinkError"); + var defaultUrl = APP.translation.translateString("defaultPreziLink", + {url: "http://prezi.com/wz7vhjycl7e6/my-prezi"}); var openPreziState = { state0: { html: '

' + html + '

' + '', + 'data-i18n="[placeholder]defaultPreziLink" data-i18n-options=\'' + + JSON.stringify({"url": "http://prezi.com/wz7vhjycl7e6/my-prezi"}) + + '\' placeholder="' + defaultUrl + '" autofocus>', persistent: false, buttons: buttons, defaultButton: 1, diff --git a/modules/UI/side_pannels/contactlist/ContactList.js b/modules/UI/side_pannels/contactlist/ContactList.js index 078dea58e..ac2b3d242 100644 --- a/modules/UI/side_pannels/contactlist/ContactList.js +++ b/modules/UI/side_pannels/contactlist/ContactList.js @@ -38,9 +38,15 @@ function createAvatar(id) { * * @param displayName the display name to set */ -function createDisplayNameParagraph(displayName) { +function createDisplayNameParagraph(key, displayName) { var p = document.createElement('p'); - p.innerText = displayName; + if(displayName) + p.innerText = displayName; + else if(key) + { + p.setAttribute("data-i18n",key); + p.innerText = APP.translation.translateString(key); + } return p; } @@ -106,7 +112,7 @@ var ContactList = { }; newContact.appendChild(createAvatar(id)); - newContact.appendChild(createDisplayNameParagraph("Participant")); + newContact.appendChild(createDisplayNameParagraph("participant")); var clElement = contactlist.get(0); diff --git a/modules/UI/toolbars/Toolbar.js b/modules/UI/toolbars/Toolbar.js index d902d8f09..6e0f1c935 100644 --- a/modules/UI/toolbars/Toolbar.js +++ b/modules/UI/toolbars/Toolbar.js @@ -197,25 +197,16 @@ function inviteParticipants() { var sharedKeyText = ""; if (sharedKey && sharedKey.length > 0) { sharedKeyText = - "This conference is password protected. Please use the " + - "following pin when joining:%0D%0A%0D%0A" + - sharedKey + "%0D%0A%0D%0A"; + APP.translation.translateString("email.sharedKey", + {sharedKey: sharedKey}); } var conferenceName = roomUrl.substring(roomUrl.lastIndexOf('/') + 1); - var subject = "Invitation to a " + interfaceConfig.APP_NAME + " (" + conferenceName + ")"; - var body = "Hey there, I%27d like to invite you to a " + interfaceConfig.APP_NAME + - " conference I%27ve just set up.%0D%0A%0D%0A" + - "Please click on the following link in order" + - " to join the conference.%0D%0A%0D%0A" + - roomUrl + - "%0D%0A%0D%0A" + - sharedKeyText + - "Note that " + interfaceConfig.APP_NAME + " is currently" + - " only supported by Chromium," + - " Google Chrome and Opera, so you need" + - " to be using one of these browsers.%0D%0A%0D%0A" + - "Talk to you in a sec!"; + var subject = APP.translation.translateString("email.subject", + {appName:interfaceConfig.APP_NAME, conferenceName: conferenceName}); + var body = APP.translation.translateString("email.body", + {appName:interfaceConfig.APP_NAME, sharedKeyText: sharedKeyText, + roomUrl: roomUrl}); if (window.localStorage.displayname) { body += "%0D%0A%0D%0A" + window.localStorage.displayname; @@ -409,16 +400,18 @@ var Toolbar = (function (my) { * Opens the invite link dialog. */ my.openLinkDialog = function () { - var inviteLink; + var inviteAttreibutes; + if (roomUrl === null) { - inviteLink = "Your conference is currently being created..."; + inviteAttreibutes = 'data-i18n="[value]roomUrlDefaultMsg" value="' + + APP.translation.translateString("roomUrlDefaultMsg") + '"'; } else { - inviteLink = encodeURI(roomUrl); + inviteAttreibutes = "value=\"" + encodeURI(roomUrl) + "\""; } messageHandler.openTwoButtonDialog("dialog.shareLink", null, null, - '', + '', false, "dialog.Invite", function (e, v) { diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index 301b9c093..aa69ee8f2 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -191,9 +191,10 @@ function getCameraVideoSize(videoWidth, /** * Sets the display name for the given video span id. */ -function setDisplayName(videoSpanId, displayName) { +function setDisplayName(videoSpanId, displayName, key) { var nameSpan = $('#' + videoSpanId + '>span.displayname'); - var defaultLocalDisplayName = interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME; + var defaultLocalDisplayName = APP.translation.generateTranslatonHTML( + interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME); // If we already have a display name for this video. if (nameSpan.length > 0) { @@ -202,14 +203,25 @@ function setDisplayName(videoSpanId, displayName) { if (nameSpanElement.id === 'localDisplayName' && $('#localDisplayName').text() !== displayName) { if (displayName && displayName.length > 0) - $('#localDisplayName').html(displayName + ' (me)'); + { + var meHTML = APP.translation.generateTranslatonHTML("me"); + $('#localDisplayName').html(displayName + ' (' + meHTML + ')'); + } else - $('#localDisplayName').text(defaultLocalDisplayName); + $('#localDisplayName').html(defaultLocalDisplayName); } else { if (displayName && displayName.length > 0) + { $('#' + videoSpanId + '_name').html(displayName); + } + else if (key && key.length > 0) + { + var nameHtml = APP.translation.generateTranslatonHTML(key); + $('#' + videoSpanId + '_name').html(nameHtml); + } else - $('#' + videoSpanId + '_name').text(interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME); + $('#' + videoSpanId + '_name').text( + interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME); } } else { var editButton = null; @@ -220,15 +232,22 @@ function setDisplayName(videoSpanId, displayName) { if (videoSpanId === 'localVideoContainer') { editButton = createEditDisplayNameButton(); - nameSpan.innerText = defaultLocalDisplayName; + if (displayName && displayName.length > 0) { + var meHTML = APP.translation.generateTranslatonHTML("me"); + nameSpan.innerHTML = displayName + meHTML; + } + else + nameSpan.innerHTML = defaultLocalDisplayName; } else { - nameSpan.innerText = interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME; + if (displayName && displayName.length > 0) { + + nameSpan.innerText = displayName; + } + else + nameSpan.innerText = interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME; } - if (displayName && displayName.length > 0) { - nameSpan.innerText = displayName; - } if (!editButton) { nameSpan.id = videoSpanId + '_name'; @@ -245,11 +264,18 @@ function setDisplayName(videoSpanId, displayName) { if (displayName && displayName.length) { editableText.value - = displayName.substring(0, displayName.indexOf(' (me)')); + = displayName; } + var defaultNickname = APP.translation.translateString( + "defaultNickname", {name: "Jane Pink"}); editableText.setAttribute('style', 'display:none;'); - editableText.setAttribute('placeholder', 'ex. Jane Pink'); + editableText.setAttribute('data-18n', + '[placeholder]defaultNickname'); + editableText.setAttribute("data-i18n-options", + JSON.stringify({name: "Jane Pink"})); + editableText.setAttribute("placeholder", defaultNickname); + $('#' + videoSpanId)[0].appendChild(editableText); $('#localVideoContainer .displayname') @@ -1270,10 +1296,17 @@ var VideoLayout = (function (my) { if (!$('#localDisplayName').is(":visible")) { if (NicknameHandler.getNickname()) - $('#localDisplayName').text(NicknameHandler.getNickname() + " (me)"); + { + var meHTML = APP.translation.generateTranslatonHTML("me"); + $('#localDisplayName').html(NicknameHandler.getNickname() + " (" + meHTML + ")"); + } else + { + var defaultHTML = APP.translation.generateTranslatonHTML( + interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME); $('#localDisplayName') - .text(interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME); + .html(defaultHTML); + } $('#localDisplayName').show(); } @@ -1796,17 +1829,20 @@ var VideoLayout = (function (my) { === APP.xmpp.myResource()) return; + var members = APP.xmpp.getMembers(); // Update the current dominant speaker. if (resourceJid !== currentDominantSpeaker) { var oldSpeakerVideoSpanId = "participant_" + currentDominantSpeaker, newSpeakerVideoSpanId = "participant_" + resourceJid; - if($("#" + oldSpeakerVideoSpanId + ">span.displayname").text() === - interfaceConfig.DEFAULT_DOMINANT_SPEAKER_DISPLAY_NAME) { + var currentJID = APP.xmpp.findJidFromResource(currentDominantSpeaker); + var newJID = APP.xmpp.findJidFromResource(resourceJid); + if(currentDominantSpeaker && (!members || !members[currentJID] || + !members[currentJID].displayName)) { setDisplayName(oldSpeakerVideoSpanId, null); } - if($("#" + newSpeakerVideoSpanId + ">span.displayname").text() === - interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME) { - setDisplayName(newSpeakerVideoSpanId, + if(resourceJid && (!members || !members[newJID] || + !members[newJID].displayName)) { + setDisplayName(newSpeakerVideoSpanId, null, interfaceConfig.DEFAULT_DOMINANT_SPEAKER_DISPLAY_NAME); } currentDominantSpeaker = resourceJid;