mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
add translation for ribbon widgets: book_properties.js
This commit is contained in:
parent
97e127a4af
commit
d47a5c4ffe
@ -1,5 +1,6 @@
|
|||||||
import NoteContextAwareWidget from "../note_context_aware_widget.js";
|
import NoteContextAwareWidget from "../note_context_aware_widget.js";
|
||||||
import attributeService from "../../services/attributes.js";
|
import attributeService from "../../services/attributes.js";
|
||||||
|
import { t } from "../../services/i18n.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="book-properties-widget">
|
<div class="book-properties-widget">
|
||||||
@ -15,32 +16,33 @@ const TPL = `
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div style="display: flex; align-items: baseline">
|
<div style="display: flex; align-items: baseline">
|
||||||
<span style="white-space: nowrap">View type: </span>
|
<span style="white-space: nowrap">${t("book_properties.view_type")}: </span>
|
||||||
|
|
||||||
<select class="view-type-select form-control form-control-sm">
|
<select class="view-type-select form-control form-control-sm">
|
||||||
<option value="grid">Grid</option>
|
<option value="grid">${t("book_properties.grid")}</option>
|
||||||
<option value="list">List</option>
|
<option value="list">${t("book_properties.list")}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="collapse-all-button btn btn-sm"
|
class="collapse-all-button btn btn-sm"
|
||||||
title="Collapse all notes">
|
title="${t("book_properties.collapse_all_notes")}">
|
||||||
|
|
||||||
<span class="bx bx-layer-minus"></span>
|
<span class="bx bx-layer-minus"></span>
|
||||||
|
|
||||||
Collapse
|
${t("book_properties.collapse")}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="expand-children-button btn btn-sm"
|
class="expand-children-button btn btn-sm"
|
||||||
title="Expand all children">
|
title="${t("book_properties.expand_all_children")}">
|
||||||
<span class="bx bx-move-vertical"></span>
|
<span class="bx bx-move-vertical"></span>
|
||||||
|
|
||||||
Expand
|
${t("book_properties.expand")}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default class BookPropertiesWidget extends NoteContextAwareWidget {
|
export default class BookPropertiesWidget extends NoteContextAwareWidget {
|
||||||
get name() {
|
get name() {
|
||||||
return "bookProperties";
|
return "bookProperties";
|
||||||
@ -58,7 +60,7 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
|
|||||||
return {
|
return {
|
||||||
show: this.isEnabled(),
|
show: this.isEnabled(),
|
||||||
activate: true,
|
activate: true,
|
||||||
title: 'Book Properties',
|
title: t("book_properties.book_properties"),
|
||||||
icon: 'bx bx-book'
|
icon: 'bx bx-book'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -101,7 +103,7 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
|
|||||||
|
|
||||||
async toggleViewType(type) {
|
async toggleViewType(type) {
|
||||||
if (type !== 'list' && type !== 'grid') {
|
if (type !== 'list' && type !== 'grid') {
|
||||||
throw new Error(`Invalid view type '${type}'`);
|
throw new Error(t("book_properties.invalid_view_type", { type }));
|
||||||
}
|
}
|
||||||
|
|
||||||
await attributeService.setLabel(this.noteId, 'viewType', type);
|
await attributeService.setLabel(this.noteId, 'viewType', type);
|
||||||
|
@ -661,5 +661,16 @@
|
|||||||
"note_type": "笔记类型",
|
"note_type": "笔记类型",
|
||||||
"editable": "可编辑",
|
"editable": "可编辑",
|
||||||
"basic_properties": "基本属性"
|
"basic_properties": "基本属性"
|
||||||
|
},
|
||||||
|
"book_properties": {
|
||||||
|
"view_type": "视图类型",
|
||||||
|
"grid": "网格",
|
||||||
|
"list": "列表",
|
||||||
|
"collapse_all_notes": "折叠所有笔记",
|
||||||
|
"expand_all_children": "展开所有子项",
|
||||||
|
"collapse": "折叠",
|
||||||
|
"expand": "展开",
|
||||||
|
"book_properties": "书籍属性",
|
||||||
|
"invalid_view_type": "无效的查看类型 '{{type}}'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -662,5 +662,16 @@
|
|||||||
"note_type": "Note type",
|
"note_type": "Note type",
|
||||||
"editable": "Editable",
|
"editable": "Editable",
|
||||||
"basic_properties": "Basic Properties"
|
"basic_properties": "Basic Properties"
|
||||||
|
},
|
||||||
|
"book_properties": {
|
||||||
|
"view_type": "View type",
|
||||||
|
"grid": "Grid",
|
||||||
|
"list": "List",
|
||||||
|
"collapse_all_notes": "Collapse all notes",
|
||||||
|
"expand_all_children": "Expand all children",
|
||||||
|
"collapse": "Collapse",
|
||||||
|
"expand": "Expand",
|
||||||
|
"book_properties": "Book Properties",
|
||||||
|
"invalid_view_type": "Invalid view type '{{type}}'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user