client: Translate shared switch

This commit is contained in:
Elian Doran 2024-09-08 22:11:52 +03:00
parent a0fdaabb1f
commit e4066ba164
No known key found for this signature in database
3 changed files with 21 additions and 8 deletions

View File

@ -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 {

View File

@ -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."
}
}

View File

@ -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"
}
}