From dbe3381e7d9bc987f1f04c59afbdf4934341815f Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Mon, 18 Sep 2023 20:35:50 +0200 Subject: [PATCH] Fix concatenation of translated strings in paste mode --- public/lang/de.json | 24 ++++++++++---------- public/lang/en.json | 8 +++---- public/lang/nb.json | 10 ++++----- public/lang/ru.json | 8 +++---- public/lang/zh-CN.json | 8 +++---- public/scripts/ui.js | 25 +++++++++++---------- public_included_ws_fallback/lang/de.json | 24 ++++++++++---------- public_included_ws_fallback/lang/en.json | 8 +++---- public_included_ws_fallback/lang/nb.json | 10 ++++----- public_included_ws_fallback/lang/ru.json | 8 +++---- public_included_ws_fallback/lang/zh-CN.json | 8 +++---- public_included_ws_fallback/scripts/ui.js | 25 +++++++++++---------- 12 files changed, 84 insertions(+), 82 deletions(-) diff --git a/public/lang/de.json b/public/lang/de.json index 28a36dd..5a6bd0b 100644 --- a/public/lang/de.json +++ b/public/lang/de.json @@ -16,8 +16,6 @@ "dialogs": { "share": "Teilen", "download": "Herunterladen", - "activate-paste-mode-base": "Öffne PairDrop auf anderen Geräten um", - "activate-paste-mode-and-other-files": "und {{count}} andere Dateien zu senden", "pair-devices-title": "Geräte dauerhaft koppeln", "input-key-on-this-device": "Gebe diesen Schlüssel auf einem anderen Gerät ein", "enter-key-from-another-device": "Gebe den Schlüssel von einem anderen Gerät hier ein.", @@ -39,20 +37,19 @@ "receive-text-title": "Textnachricht erhalten", "file-other-description-image-plural": "und {{count}} andere Bilder", "file-other-description-file-plural": "und {{count}} andere Dateien", - "activate-paste-mode-activate-paste-mode-shared-text": "Freigegebener Text", "auto-accept-instructions-1": "Aktiviere", "auto-accept": "auto-accept", "auto-accept-instructions-2": "um automatisch alle Dateien von diesem Gerät zu akzeptieren.", "has-sent": "hat Folgendes gesendet:", "send-message-title": "Textnachricht senden", "send-message-to": "Sende eine Textnachricht an", - "base64-tap-to-paste": "Tippe hier um {{type}} einzufügen", - "base64-paste-to-send": "Füge {{type}} hier zum Versenden ein", + "base64-tap-to-paste": "Hier tippen, um {{type}} einzufügen", + "base64-paste-to-send": "Hier einfügen, um {{type}} zu versenden", "base64-text": "Text", "base64-files": "Dateien", "base64-processing": "Bearbeitung läuft…", - "file-other-description-image": "und 1 anderes Bild", - "file-other-description-file": "und 1 andere Datei", + "file-other-description-image": "und ein anderes Bild", + "file-other-description-file": "und eine andere Datei", "receive-title": "{{descriptor}} erhalten", "download-again": "Erneut herunterladen", "system-language": "Systemsprache", @@ -127,15 +124,18 @@ "online-requirement-public-room": "Du musst online sein, um öffentliche Räume erstellen zu können." }, "instructions": { - "x-instructions_desktop": "Klicke zum Senden von Dateien oder klicke mit der rechten Maustaste zum Senden von Textnachrichten", - "no-peers-title": "Öffne PairDrop auf anderen Geräten um Dateien zu senden", + "x-instructions_desktop": "Klicke, um Dateien zu Senden oder klicke mit der rechten Maustaste, um Textnachrichten zu senden", + "no-peers-title": "Öffne PairDrop auf anderen Geräten, um Dateien zu senden", "no-peers_data-drop-bg": "Hier ablegen, um Empfänger auszuwählen", "no-peers-subtitle": "Kopple Geräte oder besuche einen öffentlichen Raum, damit du in anderen Netzwerken sichtbar bist", - "click-to-send": "Klicke zum Senden", - "tap-to-send": "Tippe zum Senden", + "click-to-send": "Klicke zum Senden von", + "tap-to-send": "Tippe zum Senden von", "x-instructions_data-drop-peer": "Hier ablegen, um an Peer zu senden", "x-instructions_data-drop-bg": "Loslassen um Empfänger auszuwählen", - "x-instructions_mobile": "Tippe zum Senden von Dateien oder tippe lange zum Senden von Nachrichten" + "x-instructions_mobile": "Tippe zum Senden von Dateien oder tippe lange zum Senden von Nachrichten", + "activate-paste-mode-base": "Öffne PairDrop auf anderen Geräten zum Senden von", + "activate-paste-mode-and-other-files": "und {{count}} anderen Dateien", + "activate-paste-mode-shared-text": "freigegebenem Text" }, "document-titles": { "file-transfer-requested": "Datenübertagung angefordert", diff --git a/public/lang/en.json b/public/lang/en.json index c6d6f01..70b49bd 100644 --- a/public/lang/en.json +++ b/public/lang/en.json @@ -22,7 +22,10 @@ "x-instructions_data-drop-peer": "Release to send to peer", "x-instructions_data-drop-bg": "Release to select recipient", "click-to-send": "Click to send", - "tap-to-send": "Tap to send" + "tap-to-send": "Tap to send", + "activate-paste-mode-base": "Open PairDrop on other devices to send", + "activate-paste-mode-and-other-files": "and {{count}} other files", + "activate-paste-mode-shared-text": "shared text" }, "footer": { "known-as": "You are known as:", @@ -40,9 +43,6 @@ "webrtc": "if WebRTC is not available." }, "dialogs": { - "activate-paste-mode-base": "Open PairDrop on other devices to send", - "activate-paste-mode-and-other-files": "and {{count}} other files", - "activate-paste-mode-activate-paste-mode-shared-text": "shared text", "pair-devices-title": "Pair Devices Permanently", "input-key-on-this-device": "Input this key on another device", "scan-qr-code": "or scan the QR-code.", diff --git a/public/lang/nb.json b/public/lang/nb.json index 8346a2c..e63448f 100644 --- a/public/lang/nb.json +++ b/public/lang/nb.json @@ -30,7 +30,10 @@ "no-peers-title": "Åpne PairDrop på andre enheter for å sende filer", "no-peers-subtitle": "Sammenkoble enheter for å kunne oppdages på andre nettverk", "x-instructions_data-drop-peer": "Slipp for å sende til likemann", - "tap-to-send": "Trykk for å sende" + "tap-to-send": "Trykk for å sende", + "activate-paste-mode-base": "Åpne PairDrop på andre enheter for å sende", + "activate-paste-mode-and-other-files": "og {{count}} andre filer", + "activate-paste-mode-shared-text": "delt tekst" }, "dialogs": { "input-key-on-this-device": "Skriv inn denne nøkkelen på en annen enhet", @@ -70,10 +73,7 @@ "file-other-description-file": "og én annen fil", "title-image": "Bilde", "title-file": "Fil", - "title-image-plural": "Bilder", - "activate-paste-mode-base": "Åpne PairDrop på andre enheter for å sende", - "activate-paste-mode-and-other-files": "og {{count}} andre filer", - "activate-paste-mode-activate-paste-mode-shared-text": "delt tekst" + "title-image-plural": "Bilder" }, "about": { "close-about_aria-label": "Lukk «Om PairDrop»", diff --git a/public/lang/ru.json b/public/lang/ru.json index a38a0a6..a4476d3 100644 --- a/public/lang/ru.json +++ b/public/lang/ru.json @@ -22,7 +22,10 @@ "x-instructions_data-drop-peer": "Отпустите, чтобы послать узлу", "x-instructions_mobile": "Прикоснитесь коротко, чтобы отправить файлы, или долго, чтобы отправить сообщение", "no-peers-title": "Откройте PairDrop на других устройствах, чтобы отправить файлы", - "no-peers-subtitle": "Сопрягите устройства или войдите в публичную комнату, чтобы вас могли обнаружить из других сетей" + "no-peers-subtitle": "Сопрягите устройства или войдите в публичную комнату, чтобы вас могли обнаружить из других сетей", + "activate-paste-mode-and-other-files": "и {{count}} других файлов", + "activate-paste-mode-base": "Откройте PairDrop на других устройствах, чтобы отправить", + "activate-paste-mode-shared-text": "общий текст" }, "footer": { "display-name_data-placeholder": "Загрузка…", @@ -40,9 +43,6 @@ "on-this-network_title": "Вы можете быть обнаружены кем угодно в этой сети." }, "dialogs": { - "activate-paste-mode-and-other-files": "и {{count}} других файлов", - "activate-paste-mode-base": "Откройте PairDrop на других устройствах, чтобы отправить", - "activate-paste-mode-activate-paste-mode-shared-text": "общий текст", "edit-paired-devices-title": "Редактировать сопряженные устройства", "auto-accept": "автоприем", "close": "Закрыть", diff --git a/public/lang/zh-CN.json b/public/lang/zh-CN.json index c59244c..c8b07af 100644 --- a/public/lang/zh-CN.json +++ b/public/lang/zh-CN.json @@ -22,7 +22,10 @@ "x-instructions_mobile": "轻触以发送文件 或 长按来发送信息", "x-instructions_data-drop-bg": "释放来选择接收者", "click-to-send": "点击发送", - "tap-to-send": "轻触发送" + "tap-to-send": "轻触发送", + "activate-paste-mode-base": "在其他设备上打开 PairDrop 来发送", + "activate-paste-mode-and-other-files": "和 {{count}} 个其他的文件", + "activate-paste-mode-shared-text": "分享文本" }, "footer": { "routed": "途径服务器", @@ -40,9 +43,6 @@ "on-this-network_title": "您可以被这个网络上的每个人发现。" }, "dialogs": { - "activate-paste-mode-base": "在其他设备上打开 PairDrop 来发送", - "activate-paste-mode-and-other-files": "和 {{count}} 个其他的文件", - "activate-paste-mode-activate-paste-mode-shared-text": "分享文本", "pair-devices-title": "配对新设备(常驻)", "input-key-on-this-device": "在另一个设备上输入这串数字", "base64-text": "信息", diff --git a/public/scripts/ui.js b/public/scripts/ui.js index 6309999..f93cb5d 100644 --- a/public/scripts/ui.js +++ b/public/scripts/ui.js @@ -259,27 +259,28 @@ class PeersUI { _activatePasteMode(files, text) { if (!window.pasteMode.activated && (files.length > 0 || text.length > 0)) { - let descriptor; - let noPeersMessage; + const openPairDrop = Localization.getTranslation("instructions.activate-paste-mode-base"); + const andOtherFiles = Localization.getTranslation("instructions.activate-paste-mode-and-other-files", null, {count: files.length-1}); + const sharedText = Localization.getTranslation("instructions.activate-paste-mode-shared-text"); + const clickToSend = Localization.getTranslation("instructions.click-to-send") + const tapToSend = Localization.getTranslation("instructions.tap-to-send") - const openPairDrop = Localization.getTranslation("dialogs.activate-paste-mode-base"); - const andOtherFiles = Localization.getTranslation("dialogs.activate-paste-mode-and-other-files", null, {count: files.length-1}); - const sharedText = Localization.getTranslation("dialogs.activate-paste-mode-shared-text"); + let descriptor; if (files.length === 1) { - noPeersMessage = `${openPairDrop}
${files[0].name}`; + descriptor = `${files[0].name}`; } else if (files.length > 1) { - noPeersMessage = `${openPairDrop}
${files[0].name} ${andOtherFiles}`; + descriptor = `${files[0].name}
${andOtherFiles}`; } else { - noPeersMessage = `${openPairDrop}
${sharedText}`; + descriptor = sharedText; } - this.$xInstructions.querySelector('p').innerHTML = noPeersMessage; + this.$xInstructions.querySelector('p').innerHTML = `${descriptor}`; this.$xInstructions.querySelector('p').style.display = 'block'; - this.$xInstructions.setAttribute('desktop', Localization.getTranslation("instructions.click-to-send")); - this.$xInstructions.setAttribute('mobile', Localization.getTranslation("instructions.tap-to-send")); + this.$xInstructions.setAttribute('desktop', clickToSend); + this.$xInstructions.setAttribute('mobile', tapToSend); - this.$xNoPeers.querySelector('h2').innerHTML = noPeersMessage; + this.$xNoPeers.querySelector('h2').innerHTML = `${openPairDrop}
${descriptor}`; const _callback = (e) => this._sendClipboardData(e, files, text); Events.on('paste-pointerdown', _callback); diff --git a/public_included_ws_fallback/lang/de.json b/public_included_ws_fallback/lang/de.json index 28a36dd..5a6bd0b 100644 --- a/public_included_ws_fallback/lang/de.json +++ b/public_included_ws_fallback/lang/de.json @@ -16,8 +16,6 @@ "dialogs": { "share": "Teilen", "download": "Herunterladen", - "activate-paste-mode-base": "Öffne PairDrop auf anderen Geräten um", - "activate-paste-mode-and-other-files": "und {{count}} andere Dateien zu senden", "pair-devices-title": "Geräte dauerhaft koppeln", "input-key-on-this-device": "Gebe diesen Schlüssel auf einem anderen Gerät ein", "enter-key-from-another-device": "Gebe den Schlüssel von einem anderen Gerät hier ein.", @@ -39,20 +37,19 @@ "receive-text-title": "Textnachricht erhalten", "file-other-description-image-plural": "und {{count}} andere Bilder", "file-other-description-file-plural": "und {{count}} andere Dateien", - "activate-paste-mode-activate-paste-mode-shared-text": "Freigegebener Text", "auto-accept-instructions-1": "Aktiviere", "auto-accept": "auto-accept", "auto-accept-instructions-2": "um automatisch alle Dateien von diesem Gerät zu akzeptieren.", "has-sent": "hat Folgendes gesendet:", "send-message-title": "Textnachricht senden", "send-message-to": "Sende eine Textnachricht an", - "base64-tap-to-paste": "Tippe hier um {{type}} einzufügen", - "base64-paste-to-send": "Füge {{type}} hier zum Versenden ein", + "base64-tap-to-paste": "Hier tippen, um {{type}} einzufügen", + "base64-paste-to-send": "Hier einfügen, um {{type}} zu versenden", "base64-text": "Text", "base64-files": "Dateien", "base64-processing": "Bearbeitung läuft…", - "file-other-description-image": "und 1 anderes Bild", - "file-other-description-file": "und 1 andere Datei", + "file-other-description-image": "und ein anderes Bild", + "file-other-description-file": "und eine andere Datei", "receive-title": "{{descriptor}} erhalten", "download-again": "Erneut herunterladen", "system-language": "Systemsprache", @@ -127,15 +124,18 @@ "online-requirement-public-room": "Du musst online sein, um öffentliche Räume erstellen zu können." }, "instructions": { - "x-instructions_desktop": "Klicke zum Senden von Dateien oder klicke mit der rechten Maustaste zum Senden von Textnachrichten", - "no-peers-title": "Öffne PairDrop auf anderen Geräten um Dateien zu senden", + "x-instructions_desktop": "Klicke, um Dateien zu Senden oder klicke mit der rechten Maustaste, um Textnachrichten zu senden", + "no-peers-title": "Öffne PairDrop auf anderen Geräten, um Dateien zu senden", "no-peers_data-drop-bg": "Hier ablegen, um Empfänger auszuwählen", "no-peers-subtitle": "Kopple Geräte oder besuche einen öffentlichen Raum, damit du in anderen Netzwerken sichtbar bist", - "click-to-send": "Klicke zum Senden", - "tap-to-send": "Tippe zum Senden", + "click-to-send": "Klicke zum Senden von", + "tap-to-send": "Tippe zum Senden von", "x-instructions_data-drop-peer": "Hier ablegen, um an Peer zu senden", "x-instructions_data-drop-bg": "Loslassen um Empfänger auszuwählen", - "x-instructions_mobile": "Tippe zum Senden von Dateien oder tippe lange zum Senden von Nachrichten" + "x-instructions_mobile": "Tippe zum Senden von Dateien oder tippe lange zum Senden von Nachrichten", + "activate-paste-mode-base": "Öffne PairDrop auf anderen Geräten zum Senden von", + "activate-paste-mode-and-other-files": "und {{count}} anderen Dateien", + "activate-paste-mode-shared-text": "freigegebenem Text" }, "document-titles": { "file-transfer-requested": "Datenübertagung angefordert", diff --git a/public_included_ws_fallback/lang/en.json b/public_included_ws_fallback/lang/en.json index c6d6f01..70b49bd 100644 --- a/public_included_ws_fallback/lang/en.json +++ b/public_included_ws_fallback/lang/en.json @@ -22,7 +22,10 @@ "x-instructions_data-drop-peer": "Release to send to peer", "x-instructions_data-drop-bg": "Release to select recipient", "click-to-send": "Click to send", - "tap-to-send": "Tap to send" + "tap-to-send": "Tap to send", + "activate-paste-mode-base": "Open PairDrop on other devices to send", + "activate-paste-mode-and-other-files": "and {{count}} other files", + "activate-paste-mode-shared-text": "shared text" }, "footer": { "known-as": "You are known as:", @@ -40,9 +43,6 @@ "webrtc": "if WebRTC is not available." }, "dialogs": { - "activate-paste-mode-base": "Open PairDrop on other devices to send", - "activate-paste-mode-and-other-files": "and {{count}} other files", - "activate-paste-mode-activate-paste-mode-shared-text": "shared text", "pair-devices-title": "Pair Devices Permanently", "input-key-on-this-device": "Input this key on another device", "scan-qr-code": "or scan the QR-code.", diff --git a/public_included_ws_fallback/lang/nb.json b/public_included_ws_fallback/lang/nb.json index 8346a2c..e63448f 100644 --- a/public_included_ws_fallback/lang/nb.json +++ b/public_included_ws_fallback/lang/nb.json @@ -30,7 +30,10 @@ "no-peers-title": "Åpne PairDrop på andre enheter for å sende filer", "no-peers-subtitle": "Sammenkoble enheter for å kunne oppdages på andre nettverk", "x-instructions_data-drop-peer": "Slipp for å sende til likemann", - "tap-to-send": "Trykk for å sende" + "tap-to-send": "Trykk for å sende", + "activate-paste-mode-base": "Åpne PairDrop på andre enheter for å sende", + "activate-paste-mode-and-other-files": "og {{count}} andre filer", + "activate-paste-mode-shared-text": "delt tekst" }, "dialogs": { "input-key-on-this-device": "Skriv inn denne nøkkelen på en annen enhet", @@ -70,10 +73,7 @@ "file-other-description-file": "og én annen fil", "title-image": "Bilde", "title-file": "Fil", - "title-image-plural": "Bilder", - "activate-paste-mode-base": "Åpne PairDrop på andre enheter for å sende", - "activate-paste-mode-and-other-files": "og {{count}} andre filer", - "activate-paste-mode-activate-paste-mode-shared-text": "delt tekst" + "title-image-plural": "Bilder" }, "about": { "close-about_aria-label": "Lukk «Om PairDrop»", diff --git a/public_included_ws_fallback/lang/ru.json b/public_included_ws_fallback/lang/ru.json index a38a0a6..a4476d3 100644 --- a/public_included_ws_fallback/lang/ru.json +++ b/public_included_ws_fallback/lang/ru.json @@ -22,7 +22,10 @@ "x-instructions_data-drop-peer": "Отпустите, чтобы послать узлу", "x-instructions_mobile": "Прикоснитесь коротко, чтобы отправить файлы, или долго, чтобы отправить сообщение", "no-peers-title": "Откройте PairDrop на других устройствах, чтобы отправить файлы", - "no-peers-subtitle": "Сопрягите устройства или войдите в публичную комнату, чтобы вас могли обнаружить из других сетей" + "no-peers-subtitle": "Сопрягите устройства или войдите в публичную комнату, чтобы вас могли обнаружить из других сетей", + "activate-paste-mode-and-other-files": "и {{count}} других файлов", + "activate-paste-mode-base": "Откройте PairDrop на других устройствах, чтобы отправить", + "activate-paste-mode-shared-text": "общий текст" }, "footer": { "display-name_data-placeholder": "Загрузка…", @@ -40,9 +43,6 @@ "on-this-network_title": "Вы можете быть обнаружены кем угодно в этой сети." }, "dialogs": { - "activate-paste-mode-and-other-files": "и {{count}} других файлов", - "activate-paste-mode-base": "Откройте PairDrop на других устройствах, чтобы отправить", - "activate-paste-mode-activate-paste-mode-shared-text": "общий текст", "edit-paired-devices-title": "Редактировать сопряженные устройства", "auto-accept": "автоприем", "close": "Закрыть", diff --git a/public_included_ws_fallback/lang/zh-CN.json b/public_included_ws_fallback/lang/zh-CN.json index c59244c..c8b07af 100644 --- a/public_included_ws_fallback/lang/zh-CN.json +++ b/public_included_ws_fallback/lang/zh-CN.json @@ -22,7 +22,10 @@ "x-instructions_mobile": "轻触以发送文件 或 长按来发送信息", "x-instructions_data-drop-bg": "释放来选择接收者", "click-to-send": "点击发送", - "tap-to-send": "轻触发送" + "tap-to-send": "轻触发送", + "activate-paste-mode-base": "在其他设备上打开 PairDrop 来发送", + "activate-paste-mode-and-other-files": "和 {{count}} 个其他的文件", + "activate-paste-mode-shared-text": "分享文本" }, "footer": { "routed": "途径服务器", @@ -40,9 +43,6 @@ "on-this-network_title": "您可以被这个网络上的每个人发现。" }, "dialogs": { - "activate-paste-mode-base": "在其他设备上打开 PairDrop 来发送", - "activate-paste-mode-and-other-files": "和 {{count}} 个其他的文件", - "activate-paste-mode-activate-paste-mode-shared-text": "分享文本", "pair-devices-title": "配对新设备(常驻)", "input-key-on-this-device": "在另一个设备上输入这串数字", "base64-text": "信息", diff --git a/public_included_ws_fallback/scripts/ui.js b/public_included_ws_fallback/scripts/ui.js index 96d6f6f..2c9d901 100644 --- a/public_included_ws_fallback/scripts/ui.js +++ b/public_included_ws_fallback/scripts/ui.js @@ -259,27 +259,28 @@ class PeersUI { _activatePasteMode(files, text) { if (!window.pasteMode.activated && (files.length > 0 || text.length > 0)) { - let descriptor; - let noPeersMessage; + const openPairDrop = Localization.getTranslation("instructions.activate-paste-mode-base"); + const andOtherFiles = Localization.getTranslation("instructions.activate-paste-mode-and-other-files", null, {count: files.length-1}); + const sharedText = Localization.getTranslation("instructions.activate-paste-mode-shared-text"); + const clickToSend = Localization.getTranslation("instructions.click-to-send") + const tapToSend = Localization.getTranslation("instructions.tap-to-send") - const openPairDrop = Localization.getTranslation("dialogs.activate-paste-mode-base"); - const andOtherFiles = Localization.getTranslation("dialogs.activate-paste-mode-and-other-files", null, {count: files.length-1}); - const sharedText = Localization.getTranslation("dialogs.activate-paste-mode-shared-text"); + let descriptor; if (files.length === 1) { - noPeersMessage = `${openPairDrop}
${files[0].name}`; + descriptor = `${files[0].name}`; } else if (files.length > 1) { - noPeersMessage = `${openPairDrop}
${files[0].name} ${andOtherFiles}`; + descriptor = `${files[0].name}
${andOtherFiles}`; } else { - noPeersMessage = `${openPairDrop}
${sharedText}`; + descriptor = sharedText; } - this.$xInstructions.querySelector('p').innerHTML = noPeersMessage; + this.$xInstructions.querySelector('p').innerHTML = `${descriptor}`; this.$xInstructions.querySelector('p').style.display = 'block'; - this.$xInstructions.setAttribute('desktop', Localization.getTranslation("instructions.click-to-send")); - this.$xInstructions.setAttribute('mobile', Localization.getTranslation("instructions.tap-to-send")); + this.$xInstructions.setAttribute('desktop', clickToSend); + this.$xInstructions.setAttribute('mobile', tapToSend); - this.$xNoPeers.querySelector('h2').innerHTML = noPeersMessage; + this.$xNoPeers.querySelector('h2').innerHTML = `${openPairDrop}
${descriptor}`; const _callback = (e) => this._sendClipboardData(e, files, text); Events.on('paste-pointerdown', _callback);