Skip to content

Build your personal knowledge base with Trilium Notes

add translation for ribbon widgets: book_properties.js

Nriverd47a5c4ffe0b
diff --git a/src/public/app/widgets/ribbon_widgets/book_properties.js b/src/public/app/widgets/ribbon_widgets/book_properties.js
index 90147b7bfc..74cefef1fd 100644
--- a/src/public/app/widgets/ribbon_widgets/book_properties.js
+++ b/src/public/app/widgets/ribbon_widgets/book_properties.js
@@ -1,5 +1,6 @@
import NoteContextAwareWidget from "../note_context_aware_widget.js";
import attributeService from "../../services/attributes.js";
+import { t } from "../../services/i18n.js";
const TPL = `
<div class="book-properties-widget">
@@ -15,32 +16,33 @@ const TPL = `
</style>
<div style="display: flex; align-items: baseline">
- <span style="white-space: nowrap">View type:&nbsp; &nbsp;</span>
+ <span style="white-space: nowrap">${t("book_properties.view_type")}:&nbsp; &nbsp;</span>
<select class="view-type-select form-control form-control-sm">
- <option value="grid">Grid</option>
- <option value="list">List</option>
+ <option value="grid">${t("book_properties.grid")}</option>
+ <option value="list">${t("book_properties.list")}</option>
</select>
</div>
<button type="button"
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>
- Collapse
+ ${t("book_properties.collapse")}
</button>
<button type="button"
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>
- Expand
+ ${t("book_properties.expand")}
</button>
</div>
`;
+
export default class BookPropertiesWidget extends NoteContextAwareWidget {
get name() {
return "bookProperties";
@@ -58,7 +60,7 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
return {
show: this.isEnabled(),
activate: true,
- title: 'Book Properties',
+ title: t("book_properties.book_properties"),
icon: 'bx bx-book'
};
}
@@ -101,7 +103,7 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
async toggleViewType(type) {
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);
diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.json
index 4a48fffc0d..4dc9330796 100644
--- a/src/public/translations/cn/translation.json
+++ b/src/public/translations/cn/translation.json
@@ -661,5 +661,16 @@
"note_type": "笔记类型",
"editable": "可编辑",
"basic_properties": "基本属性"
+ },
+ "book_properties": {
+ "view_type": "视图类型",
+ "grid": "网格",
+ "list": "列表",
+ "collapse_all_notes": "折叠所有笔记",
+ "expand_all_children": "展开所有子项",
+ "collapse": "折叠",
+ "expand": "展开",
+ "book_properties": "书籍属性",
+ "invalid_view_type": "无效的查看类型 '{{type}}'"
}
}
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index 67f4b1bb3b..9014f131d2 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -662,5 +662,16 @@
"note_type": "Note type",
"editable": "Editable",
"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}}'"
}
}