mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
add translation for bookmark_switch.js and editability_select.js
This commit is contained in:
parent
0198f135ac
commit
8e87bcf37b
@ -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) {
|
||||
|
@ -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 = `
|
||||
<div class="dropdown editability-select-widget">
|
||||
@ -15,24 +16,24 @@ const TPL = `
|
||||
}
|
||||
</style>
|
||||
<button type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-sm dropdown-toggle editability-button">
|
||||
<span class="editability-active-desc">auto</span>
|
||||
<span class="editability-active-desc">${t("editability_select.auto")}</span>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<div class="editability-dropdown dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="#" data-editability="auto">
|
||||
<span class="check">✓</span>
|
||||
Auto
|
||||
<div>Note is editable if it's not too long.</div>
|
||||
${t("editability_select.auto")}
|
||||
<div>${t("editability_select.note_is_editable")}</div>
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-editability="readOnly">
|
||||
<span class="check">✓</span>
|
||||
Read-only
|
||||
<div>Note is read-only, but can be edited with a button click.</div>
|
||||
${t("editability_select.read_only")}
|
||||
<div>${t("editability_select.note_is_read_only")}</div>
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-editability="autoReadOnlyDisabled">
|
||||
<span class="check">✓</span>
|
||||
Always editable
|
||||
<div>Note is always editable, regardless of its length.</div>
|
||||
${t("editability_select.always_editable")}
|
||||
<div>${t("editability_select.note_is_always_editable")}</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -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");
|
||||
|
@ -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": "无论笔记长度如何,始终可编辑。"
|
||||
}
|
||||
}
|
||||
|
@ -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."
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user