From e4066ba164938e33d0ddce0d42ff193bcadc401e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 8 Sep 2024 22:11:52 +0300 Subject: [PATCH] client: Translate shared switch --- src/public/app/widgets/shared_switch.js | 15 +++++++-------- src/public/translations/en/translation.json | 7 +++++++ src/public/translations/ro/translation.json | 7 +++++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/public/app/widgets/shared_switch.js b/src/public/app/widgets/shared_switch.js index 65f654c14..2a51eddc8 100644 --- a/src/public/app/widgets/shared_switch.js +++ b/src/public/app/widgets/shared_switch.js @@ -4,6 +4,7 @@ import server from "../services/server.js"; import utils from "../services/utils.js"; import syncService from "../services/sync.js"; import dialogService from "../services/dialog.js"; +import { t } from "../services/i18n.js"; export default class SharedSwitchWidget extends SwitchWidget { isEnabled() { @@ -15,11 +16,11 @@ export default class SharedSwitchWidget extends SwitchWidget { doRender() { super.doRender(); - this.$switchOnName.text("Shared"); - this.$switchOnButton.attr("title", "Share the note"); + this.$switchOnName.text(t("shared_switch.shared")); + this.$switchOnButton.attr("title", t("shared_switch.toggle-on-title")); - this.$switchOffName.text("Shared"); - this.$switchOffButton.attr("title", "Unshare the note"); + this.$switchOffName.text(t("shared_switch.shared")); + this.$switchOffButton.attr("title", t("shared_switch.toggle-off-title")); this.$helpButton.attr("data-help-page", "sharing.html").show(); this.$helpButton.on('click', e => utils.openHelp($(e.target))); @@ -39,9 +40,7 @@ export default class SharedSwitchWidget extends SwitchWidget { } if (this.note.getParentBranches().length === 1) { - const text = "This note exists only as a shared note, unsharing would delete it. Do you want to continue and thus delete this note?"; - - if (!await dialogService.confirm(text)) { + if (!await dialogService.confirm(t("shared_switch.shared-branch"))) { return; } } @@ -60,7 +59,7 @@ export default class SharedSwitchWidget extends SwitchWidget { this.$switchOff.toggle(!!isShared); if (switchDisabled) { - this.$widget.attr("title", "Note cannot be unshared here because it is shared through inheritance from an ancestor."); + this.$widget.attr("title", t("shared_switch.inherited")); this.$switchOff.addClass("switch-disabled"); } else { diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index 48a0fd5cc..7bafb379f 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -1305,5 +1305,12 @@ "toggle-off": "Unprotect the note", "toggle-on-hint": "Note is not protected, click to make it protected", "toggle-off-hint": "Note is protected, click to make it unprotected" + }, + "shared_switch": { + "shared": "Shared", + "toggle-on-title": "Share the note", + "toggle-off-title": "Unshare the note", + "shared-branch": "This note exists only as a shared note, unsharing would delete it. Do you want to continue and thus delete this note?", + "inherited": "Note cannot be unshared here because it is shared through inheritance from an ancestor." } } diff --git a/src/public/translations/ro/translation.json b/src/public/translations/ro/translation.json index 6cf3863af..be7f09cea 100644 --- a/src/public/translations/ro/translation.json +++ b/src/public/translations/ro/translation.json @@ -1305,5 +1305,12 @@ "toggle-off-hint": "Notița este protejată, click pentru a o deproteja", "toggle-on": "Protejează notița", "toggle-on-hint": "Notița nu este protejată, clic pentru a o proteja" + }, + "shared_switch": { + "inherited": "Nu se poate înlătura partajarea deoarece notița este partajată prin moștenirea de la o notiță părinte.", + "shared": "Partajată", + "shared-branch": "Această notiță există doar ca o notiță partajată, anularea partajării ar cauza ștergerea ei. Sigur doriți ștergerea notiței?", + "toggle-off-title": "Anulează partajarea notițeii", + "toggle-on-title": "Partajează notița" } }