mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
add translation for ribbon widgets: note_info_widget.js
This commit is contained in:
parent
931e319fbf
commit
bdc6a1fe29
@ -1,6 +1,7 @@
|
|||||||
import NoteContextAwareWidget from "../note_context_aware_widget.js";
|
import NoteContextAwareWidget from "../note_context_aware_widget.js";
|
||||||
import server from "../../services/server.js";
|
import server from "../../services/server.js";
|
||||||
import utils from "../../services/utils.js";
|
import utils from "../../services/utils.js";
|
||||||
|
import { t } from "../../services/i18n.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="note-info-widget">
|
<div class="note-info-widget">
|
||||||
@ -30,31 +31,27 @@ const TPL = `
|
|||||||
|
|
||||||
<table class="note-info-widget-table">
|
<table class="note-info-widget-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Note ID:</th>
|
<th>${t("note_info_widget.note_id")}:</th>
|
||||||
<td class="note-info-note-id"></td>
|
<td class="note-info-note-id"></td>
|
||||||
<th>Created:</th>
|
<th>${t("note_info_widget.created")}:</th>
|
||||||
<td class="note-info-date-created"></td>
|
<td class="note-info-date-created"></td>
|
||||||
<th>Modified:</th>
|
<th>${t("note_info_widget.modified")}:</th>
|
||||||
<td class="note-info-date-modified"></td>
|
<td class="note-info-date-modified"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Type:</th>
|
<th>${t("note_info_widget.type")}:</th>
|
||||||
<td>
|
<td>
|
||||||
<span class="note-info-type"></span>
|
<span class="note-info-type"></span>
|
||||||
|
|
||||||
<span class="note-info-mime"></span>
|
<span class="note-info-mime"></span>
|
||||||
</td>
|
</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">
|
<td colspan="3">
|
||||||
<button class="btn btn-sm calculate-button" style="padding: 0px 10px 0px 10px;">
|
<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>
|
</button>
|
||||||
|
|
||||||
<span class="note-sizes-wrapper">
|
<span class="note-sizes-wrapper">
|
||||||
<span class="note-size"></span>
|
<span class="note-size"></span>
|
||||||
|
|
||||||
<span class="subtree-size"></span>
|
<span class="subtree-size"></span>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
@ -62,6 +59,7 @@ const TPL = `
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default class NoteInfoWidget extends NoteContextAwareWidget {
|
export default class NoteInfoWidget extends NoteContextAwareWidget {
|
||||||
get name() {
|
get name() {
|
||||||
return "noteInfo";
|
return "noteInfo";
|
||||||
@ -78,7 +76,7 @@ export default class NoteInfoWidget extends NoteContextAwareWidget {
|
|||||||
getTitle() {
|
getTitle() {
|
||||||
return {
|
return {
|
||||||
show: this.isEnabled(),
|
show: this.isEnabled(),
|
||||||
title: 'Note Info',
|
title: t("note_info_widget.title"),
|
||||||
icon: 'bx bx-info-circle'
|
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}`);
|
const subTreeResp = await server.get(`stats/subtree-size/${this.noteId}`);
|
||||||
|
|
||||||
if (subTreeResp.subTreeNoteCount > 1) {
|
if (subTreeResp.subTreeNoteCount > 1) {
|
||||||
this.$subTreeSize.text(`(subtree size: ${utils.formatSize(subTreeResp.subTreeSize)} in ${subTreeResp.subTreeNoteCount} notes)`);
|
this.$subTreeSize.text(t("note_info_widget.subtree_size", { size: utils.formatSize(subTreeResp.subTreeSize), count: subTreeResp.subTreeNoteCount }));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.$subTreeSize.text("");
|
this.$subTreeSize.text("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -143,7 +140,7 @@ export default class NoteInfoWidget extends NoteContextAwareWidget {
|
|||||||
this.$noteSizesWrapper.hide();
|
this.$noteSizesWrapper.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({ loadResults }) {
|
||||||
if (loadResults.isNoteReloaded(this.noteId) || loadResults.isNoteContentReloaded(this.noteId)) {
|
if (loadResults.isNoteReloaded(this.noteId) || loadResults.isNoteContentReloaded(this.noteId)) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
@ -705,5 +705,16 @@
|
|||||||
"inherited_attribute_list": {
|
"inherited_attribute_list": {
|
||||||
"title": "继承的属性",
|
"title": "继承的属性",
|
||||||
"no_inherited_attributes": "没有继承的属性。"
|
"no_inherited_attributes": "没有继承的属性。"
|
||||||
|
},
|
||||||
|
"note_info_widget": {
|
||||||
|
"note_id": "笔记ID",
|
||||||
|
"created": "创建时间",
|
||||||
|
"modified": "修改时间",
|
||||||
|
"type": "类型",
|
||||||
|
"note_size": "笔记大小",
|
||||||
|
"note_size_info": "笔记大小提供了该笔记存储需求的粗略估计。它考虑了笔记的内容及其笔记修订的内容。",
|
||||||
|
"calculate": "计算",
|
||||||
|
"subtree_size": "(子树大小: {{size}}, 共计 {{count}} 个笔记)",
|
||||||
|
"title": "笔记信息"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -706,5 +706,16 @@
|
|||||||
"inherited_attribute_list": {
|
"inherited_attribute_list": {
|
||||||
"title": "Inherited Attributes",
|
"title": "Inherited Attributes",
|
||||||
"no_inherited_attributes": "No 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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user