add translation for ribbon widgets: note_paths.js

This commit is contained in:
Nriver 2024-08-05 10:59:26 +08:00
parent 729715ebfb
commit 835891999e
3 changed files with 28 additions and 11 deletions

View File

@ -1,6 +1,7 @@
import NoteContextAwareWidget from "../note_context_aware_widget.js";
import treeService from "../../services/tree.js";
import linkService from "../../services/link.js";
import { t } from "../../services/i18n.js";
const TPL = `
<div class="note-paths-widget">
@ -32,7 +33,7 @@ const TPL = `
<ul class="note-path-list"></ul>
<button class="btn btn-sm" data-trigger-command="cloneNoteIdsTo">Clone note to new location...</button>
<button class="btn btn-sm" data-trigger-command="cloneNoteIdsTo">${t("note_paths.clone_button")}</button>
</div>`;
export default class NotePathsWidget extends NoteContextAwareWidget {
@ -47,7 +48,7 @@ export default class NotePathsWidget extends NoteContextAwareWidget {
getTitle() {
return {
show: true,
title: 'Note Paths',
title: t("note_paths.title"),
icon: 'bx bx-collection'
};
}
@ -76,10 +77,9 @@ export default class NotePathsWidget extends NoteContextAwareWidget {
.filter(notePath => !notePath.isHidden);
if (sortedNotePaths.length > 0) {
this.$notePathIntro.text("This note is placed into the following paths:");
}
else {
this.$notePathIntro.text("This note is not yet placed into the note tree.");
this.$notePathIntro.text(t("note_paths.intro_placed"));
} else {
this.$notePathIntro.text(t("note_paths.intro_not_placed"));
}
const renderedPaths = [];
@ -110,21 +110,20 @@ export default class NotePathsWidget extends NoteContextAwareWidget {
if (!notePathRecord || notePathRecord.isInHoistedSubTree) {
$noteLink.addClass("path-in-hoisted-subtree");
}
else {
icons.push(`<span class="bx bx-trending-up" title="This path is outside of hoisted note and you would have to unhoist."></span>`);
} else {
icons.push(`<span class="bx bx-trending-up" title="${t("note_paths.outside_hoisted")}"></span>`);
}
if (notePathRecord?.isArchived) {
$noteLink.addClass("path-archived");
icons.push(`<span class="bx bx-archive" title="Archived"></span>`);
icons.push(`<span class="bx bx-archive" title="${t("note_paths.archived")}"></span>`);
}
if (notePathRecord?.isSearch) {
$noteLink.addClass("path-search");
icons.push(`<span class="bx bx-search" title="Search"></span>`);
icons.push(`<span class="bx bx-search" title="${t("note_paths.search")}"></span>`);
}
if (icons.length > 0) {

View File

@ -721,5 +721,14 @@
"open_full": "展开显示",
"collapse": "折叠到正常大小",
"title": "笔记地图"
},
"note_paths": {
"title": "笔记路径",
"clone_button": "克隆笔记到新位置...",
"intro_placed": "此笔记放置在以下路径中:",
"intro_not_placed": "此笔记尚未放入笔记树中。",
"outside_hoisted": "此路径在提升的笔记之外,您需要取消提升。",
"archived": "已归档",
"search": "搜索"
}
}

View File

@ -722,5 +722,14 @@
"open_full": "Expand to full",
"collapse": "Collapse to normal size",
"title": "Note Map"
},
"note_paths": {
"title": "Note Paths",
"clone_button": "Clone note to new location...",
"intro_placed": "This note is placed into the following paths:",
"intro_not_placed": "This note is not yet placed into the note tree.",
"outside_hoisted": "This path is outside of hoisted note and you would have to unhoist.",
"archived": "Archived",
"search": "Search"
}
}