diff --git a/src/public/app/widgets/bookmark_switch.js b/src/public/app/widgets/bookmark_switch.js index 22040e3e8..ab9055df1 100644 --- a/src/public/app/widgets/bookmark_switch.js +++ b/src/public/app/widgets/bookmark_switch.js @@ -1,6 +1,7 @@ import SwitchWidget from "./switch.js"; import server from "../services/server.js"; import toastService from "../services/toast.js"; +import { t } from "../services/i18n.js"; export default class BookmarkSwitchWidget extends SwitchWidget { isEnabled() { @@ -12,11 +13,11 @@ export default class BookmarkSwitchWidget extends SwitchWidget { doRender() { super.doRender(); - this.$switchOnName.text("Bookmark"); - this.$switchOnButton.attr("title", "Bookmark this note to the left side panel"); + this.$switchOnName.text(t("bookmark_switch.bookmark")); + this.$switchOnButton.attr("title", t("bookmark_switch.bookmark_this_note")); - this.$switchOffName.text("Bookmark"); - this.$switchOffButton.attr("title", "Remove bookmark"); + this.$switchOffName.text(t("bookmark_switch.bookmark")); + this.$switchOffButton.attr("title", t("bookmark_switch.remove_bookmark")); } async toggle(state) { diff --git a/src/public/app/widgets/editability_select.js b/src/public/app/widgets/editability_select.js index 2cc4f14de..00460be18 100644 --- a/src/public/app/widgets/editability_select.js +++ b/src/public/app/widgets/editability_select.js @@ -1,5 +1,6 @@ import attributeService from '../services/attributes.js'; import NoteContextAwareWidget from "./note_context_aware_widget.js"; +import { t } from "../services/i18n.js"; const TPL = ` @@ -46,20 +47,20 @@ export default class EditabilitySelectWidget extends NoteContextAwareWidget { this.$widget.on('click', '.dropdown-item', async e => { - this.$widget.find('.dropdown-toggle').dropdown('toggle'); + this.$widget.find('.dropdown-toggle').dropdown('toggle'); - const editability = $(e.target).closest("[data-editability]").attr("data-editability"); + const editability = $(e.target).closest("[data-editability]").attr("data-editability"); - for (const ownedAttr of this.note.getOwnedLabels()) { - if (['readOnly', 'autoReadOnlyDisabled'].includes(ownedAttr.name)) { - await attributeService.removeAttributeById(this.noteId, ownedAttr.attributeId); + for (const ownedAttr of this.note.getOwnedLabels()) { + if (['readOnly', 'autoReadOnlyDisabled'].includes(ownedAttr.name)) { + await attributeService.removeAttributeById(this.noteId, ownedAttr.attributeId); + } } - } - if (editability !== 'auto') { - await attributeService.addLabel(this.noteId, editability); - } - }); + if (editability !== 'auto') { + await attributeService.addLabel(this.noteId, editability); + } + }); } async refreshWithNote(note) { @@ -73,9 +74,9 @@ export default class EditabilitySelectWidget extends NoteContextAwareWidget { } const labels = { - "auto": "Auto", - "readOnly": "Read-only", - "autoReadOnlyDisabled": "Always Editable" + "auto": t("editability_select.auto"), + "readOnly": t("editability_select.read_only"), + "autoReadOnlyDisabled": t("editability_select.always_editable") } this.$widget.find('.dropdown-item').removeClass("selected"); diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.json index 349c5d396..63b0aed5c 100644 --- a/src/public/translations/cn/translation.json +++ b/src/public/translations/cn/translation.json @@ -1229,5 +1229,18 @@ "role_and_size": "角色: {{role}}, 大小: {{size}}", "link_copied": "附件链接已复制到剪贴板。", "unrecognized_role": "无法识别的附件角色 '{{role}}'。" + }, + "bookmark_switch": { + "bookmark": "书签", + "bookmark_this_note": "将此笔记添加到左侧面板的书签", + "remove_bookmark": "移除书签" + }, + "editability_select": { + "auto": "自动", + "read_only": "只读", + "always_editable": "始终可编辑", + "note_is_editable": "笔记如果不太长则可编辑。", + "note_is_read_only": "笔记为只读,但可以通过点击按钮进行编辑。", + "note_is_always_editable": "无论笔记长度如何,始终可编辑。" } } diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index 6374c7fcf..6e61f7634 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -1229,5 +1229,18 @@ "role_and_size": "Role: {{role}}, Size: {{size}}", "link_copied": "Attachment link copied to clipboard.", "unrecognized_role": "Unrecognized attachment role '{{role}}'." + }, + "bookmark_switch": { + "bookmark": "Bookmark", + "bookmark_this_note": "Bookmark this note to the left side panel", + "remove_bookmark": "Remove bookmark" + }, + "editability_select": { + "auto": "Auto", + "read_only": "Read-only", + "always_editable": "Always Editable", + "note_is_editable": "Note is editable if it's not too long.", + "note_is_read_only": "Note is read-only, but can be edited with a button click.", + "note_is_always_editable": "Note is always editable, regardless of its length." } }