Skip to content

Build your personal knowledge base with Trilium Notes

add translation for ribbon widgets: note_info_widget.js

Nriverbdc6a1fe29ed
diff --git a/src/public/app/widgets/ribbon_widgets/note_info_widget.js b/src/public/app/widgets/ribbon_widgets/note_info_widget.js
index 8bf2207616..d6df63bd93 100644
--- a/src/public/app/widgets/ribbon_widgets/note_info_widget.js
+++ b/src/public/app/widgets/ribbon_widgets/note_info_widget.js
@@ -1,6 +1,7 @@
import NoteContextAwareWidget from "../note_context_aware_widget.js";
import server from "../../services/server.js";
import utils from "../../services/utils.js";
+import { t } from "../../services/i18n.js";
const TPL = `
<div class="note-info-widget">
@@ -30,31 +31,27 @@ const TPL = `
<table class="note-info-widget-table">
<tr>
- <th>Note ID:</th>
+ <th>${t("note_info_widget.note_id")}:</th>
<td class="note-info-note-id"></td>
- <th>Created:</th>
+ <th>${t("note_info_widget.created")}:</th>
<td class="note-info-date-created"></td>
- <th>Modified:</th>
+ <th>${t("note_info_widget.modified")}:</th>
<td class="note-info-date-modified"></td>
</tr>
<tr>
- <th>Type:</th>
+ <th>${t("note_info_widget.type")}:</th>
<td>
<span class="note-info-type"></span>
-
<span class="note-info-mime"></span>
</td>
- <th title="Note size provides rough estimate of storage requirements for this note. It takes into account note's content and content of its note revisions.">Note size:</th>
-
+ <th title="${t("note_info_widget.note_size_info")}">${t("note_info_widget.note_size")}:</th>
<td colspan="3">
<button class="btn btn-sm calculate-button" style="padding: 0px 10px 0px 10px;">
- <span class="bx bx-calculator"></span> calculate
+ <span class="bx bx-calculator"></span> ${t("note_info_widget.calculate")}
</button>
-
<span class="note-sizes-wrapper">
<span class="note-size"></span>
-
<span class="subtree-size"></span>
</span>
</td>
@@ -62,6 +59,7 @@ const TPL = `
</table>
</div>
`;
+
export default class NoteInfoWidget extends NoteContextAwareWidget {
get name() {
return "noteInfo";
@@ -78,7 +76,7 @@ export default class NoteInfoWidget extends NoteContextAwareWidget {
getTitle() {
return {
show: this.isEnabled(),
- title: 'Note Info',
+ title: t("note_info_widget.title"),
icon: 'bx bx-info-circle'
};
}
@@ -111,9 +109,8 @@ export default class NoteInfoWidget extends NoteContextAwareWidget {
const subTreeResp = await server.get(`stats/subtree-size/${this.noteId}`);
if (subTreeResp.subTreeNoteCount > 1) {
- this.$subTreeSize.text(`(subtree size: ${utils.formatSize(subTreeResp.subTreeSize)} in ${subTreeResp.subTreeNoteCount} notes)`);
- }
- else {
+ this.$subTreeSize.text(t("note_info_widget.subtree_size", { size: utils.formatSize(subTreeResp.subTreeSize), count: subTreeResp.subTreeNoteCount }));
+ } else {
this.$subTreeSize.text("");
}
});
@@ -143,7 +140,7 @@ export default class NoteInfoWidget extends NoteContextAwareWidget {
this.$noteSizesWrapper.hide();
}
- entitiesReloadedEvent({loadResults}) {
+ entitiesReloadedEvent({ loadResults }) {
if (loadResults.isNoteReloaded(this.noteId) || loadResults.isNoteContentReloaded(this.noteId)) {
this.refresh();
}
diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.json
index 5bfc4eaa42..8c962c6d6e 100644
--- a/src/public/translations/cn/translation.json
+++ b/src/public/translations/cn/translation.json
@@ -705,5 +705,16 @@
"inherited_attribute_list": {
"title": "继承的属性",
"no_inherited_attributes": "没有继承的属性。"
+ },
+ "note_info_widget": {
+ "note_id": "笔记ID",
+ "created": "创建时间",
+ "modified": "修改时间",
+ "type": "类型",
+ "note_size": "笔记大小",
+ "note_size_info": "笔记大小提供了该笔记存储需求的粗略估计。它考虑了笔记的内容及其笔记修订的内容。",
+ "calculate": "计算",
+ "subtree_size": "(子树大小: {{size}}, 共计 {{count}} 个笔记)",
+ "title": "笔记信息"
}
}
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index a9ac06123c..080166e9d7 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -706,5 +706,16 @@
"inherited_attribute_list": {
"title": "Inherited Attributes",
"no_inherited_attributes": "No inherited attributes."
+ },
+ "note_info_widget": {
+ "note_id": "Note ID",
+ "created": "Created",
+ "modified": "Modified",
+ "type": "Type",
+ "note_size": "Note size",
+ "note_size_info": "Note size provides rough estimate of storage requirements for this note. It takes into account note's content and content of its note revisions.",
+ "calculate": "calculate",
+ "subtree_size": "(subtree size: {{size}} in {{count}} notes)",
+ "title": "Note Info"
}
}