add translation for bulk action of notes

This commit is contained in:
Nriver 2024-07-30 09:40:02 +08:00
parent f7b5dbd12f
commit 50434201cf
6 changed files with 86 additions and 26 deletions

View File

@ -1,3 +1,4 @@
import { t } from "../../../services/i18n.js";
import AbstractBulkAction from "../abstract_bulk_action.js";
const TPL = `
@ -5,17 +6,17 @@ const TPL = `
<td colspan="2">
<span class="bx bx-trash"></span>
Delete matched notes
${t("delete_note.delete_matched_notes")}
</td>
<td class="button-column">
<div class="dropdown help-dropdown">
<span class="bx bx-help-circle icon-action" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
<div class="dropdown-menu dropdown-menu-right p-4">
<p>This will delete matched notes.</p>
<p>${t("delete_note.delete_matched_notes_description")}</p>
<p>After the deletion, it's possible to undelete them from <span class="bx bx-history"></span> Recent Notes dialog.</p>
<p>${t("delete_note.undelete_notes_instruction")}</p>
<p>To erase notes permanently, you can go after the deletion to the Option -> Other and click the "Erase deleted notes now" button.</p>
<p>${t("delete_note.erase_notes_instruction")}</p>
</div>
</div>

View File

@ -1,27 +1,26 @@
import { t } from "../../../services/i18n.js";
import AbstractBulkAction from "../abstract_bulk_action.js";
const TPL = `
<tr>
<td colspan="2">
<span class="bx bx-trash"></span>
Delete note revisions
${t('delete_revisions.delete_note_revisions')}
</td>
<td class="button-column">
<div class="dropdown help-dropdown">
<span class="bx bx-help-circle icon-action" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
<div class="dropdown-menu dropdown-menu-right p-4">
All past note revisions of matched notes will be deleted. Note itself will be fully preserved. In other terms, note's history will be removed.
${t('delete_revisions.all_past_note_revisions')}
</div>
</div>
<span class="bx bx-x icon-action action-conf-del"></span>
</td>
</tr>`;
export default class DeleteRevisionsBulkAction extends AbstractBulkAction {
static get actionName() { return "deleteRevisions"; }
static get actionTitle() { return "Delete note revisions"; }
static get actionTitle() { return t('delete_revisions.delete_note_revisions'); }
doRender() {
return $(TPL);

View File

@ -1,3 +1,4 @@
import { t } from "../../../services/i18n.js";
import SpacedUpdate from "../../../services/spaced_update.js";
import AbstractBulkAction from "../abstract_bulk_action.js";
import noteAutocompleteService from "../../../services/note_autocomplete.js";
@ -6,12 +7,12 @@ const TPL = `
<tr>
<td colspan="2">
<div style="display: flex; align-items: center">
<div style="margin-right: 10px;" class="text-nowrap">Move note</div>
<div style="margin-right: 10px;" class="text-nowrap">${t('move_note.move_note')}</div>
<div style="margin-right: 10px;" class="text-nowrap">to</div>
<div style="margin-right: 10px;" class="text-nowrap">${t('move_note.to')}</div>
<div class="input-group">
<input type="text" class="form-control target-parent-note" placeholder="target parent note"/>
<input type="text" class="form-control target-parent-note" placeholder="${t('move_note.target_parent_note')}"/>
</div>
</div>
</td>
@ -19,12 +20,12 @@ const TPL = `
<div class="dropdown help-dropdown">
<span class="bx bx-help-circle icon-action" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
<div class="dropdown-menu dropdown-menu-right p-4">
<p>On all matched notes:</p>
<p>${t('move_note.on_all_matched_notes')}:</p>
<ul>
<li>move note to the new parent if note has only one parent (i.e. the old placement is removed and new placement into the new parent is created)</li>
<li>clone note to the new parent if note has multiple clones/placements (it's not clear which placement should be removed)</li>
<li>nothing will happen if note cannot be moved to the target note (i.e. this would create a tree cycle)</li>
<li>${t('move_note.move_note_new_parent')}</li>
<li>${t('move_note.clone_note_new_parent')}</li>
<li>${t('move_note.nothing_will_happen')}</li>
</ul>
</div>
</div>
@ -35,7 +36,7 @@ const TPL = `
export default class MoveNoteBulkAction extends AbstractBulkAction {
static get actionName() { return "moveNote"; }
static get actionTitle() { return "Move note"; }
static get actionTitle() { return t('move_note.move_note'); }
doRender() {
const $action = $(TPL);

View File

@ -1,31 +1,32 @@
import SpacedUpdate from "../../../services/spaced_update.js";
import AbstractBulkAction from "../abstract_bulk_action.js";
import { t } from "../../../services/i18n.js";
const TPL = `
<tr>
<td colspan="2">
<div style="display: flex; align-items: center">
<div style="margin-right: 10px; flex-shrink: 0;">Rename note title to:</div>
<div style="margin-right: 10px; flex-shrink: 0;">${t('rename_note.rename_note_title_to')}</div>
<input type="text"
class="form-control new-title"
placeholder="new note title"
title="Click help icon on the right to see all the options"/>
placeholder="${t('rename_note.new_note_title')}"
title="${t('rename_note.click_help_icon')}"/>
</div>
</td>
<td class="button-column">
<div class="dropdown help-dropdown">
<span class="bx bx-help-circle icon-action" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
<div class="dropdown-menu dropdown-menu-right p-4">
<p>The given value is evaluated as JavaScript string and thus can be enriched with dynamic content via the injected <code>note</code> variable (note being renamed). Examples:</p>
<p>${t('rename_note.evaluated_as_js_string')}</p>
<ul>
<li><code>Note</code> - all matched notes are renamed to "Note"</li>
<li><code>NEW: \${note.title}</code> - matched notes titles are prefixed with "NEW: "</li>
<li><code>\${note.dateCreatedObj.format('MM-DD:')}: \${note.title}</code> - matched notes are prefixed with note's creation month-date</li>
<li>${t('rename_note.example_note')}</li>
<li>${t('rename_note.example_new_title')}</li>
<li>${t('rename_note.example_date_prefix')}</li>
</ul>
See API docs for <a href="https://zadam.github.io/trilium/backend_api/Note.html">note</a> and its <a href="https://day.js.org/docs/en/display/format">dateCreatedObj / utcDateCreatedObj properties</a> for details.
${t('rename_note.api_docs')}
</div>
</div>
@ -35,7 +36,7 @@ const TPL = `
export default class RenameNoteBulkAction extends AbstractBulkAction {
static get actionName() { return "renameNote"; }
static get actionTitle() { return "Rename note"; }
static get actionTitle() { return t('rename_note.rename_note'); }
doRender() {
const $action = $(TPL);

View File

@ -442,5 +442,34 @@
"new_value_placeholder": "新值",
"help_text": "在所有匹配的笔记上,更改现有标签的值。",
"help_text_note": "您也可以在不指定值的情况下调用此方法,这种情况下,标签将分配给没有值的笔记。"
},
"delete_note": {
"delete_matched_notes": "删除匹配的笔记",
"delete_matched_notes_description": "这将删除匹配的笔记。",
"undelete_notes_instruction": "删除后,可以从“最近修改”对话框中恢复它们。",
"erase_notes_instruction": "要永久擦除笔记,您可以在删除后转到“选项”->“其他”,然后单击“立即擦除已删除的笔记”按钮。"
},
"delete_revisions": {
"delete_note_revisions": "删除笔记修订",
"all_past_note_revisions": "所有匹配笔记的过去修订都将被删除。笔记本身将完全保留。换句话说,笔记的历史将被删除。"
},
"move_note": {
"move_note": "移动笔记",
"to": "到",
"target_parent_note": "目标父笔记",
"on_all_matched_notes": "对于所有匹配的笔记",
"move_note_new_parent": "如果笔记只有一个父笔记,则将其移动到新父笔记(即旧位置被移除,并创建到新父笔记的位置)",
"clone_note_new_parent": "如果笔记有多个克隆/位置,则将其克隆到新父笔记(不清楚应删除哪个位置)",
"nothing_will_happen": "如果笔记无法移动到目标笔记(即这会创建一个树循环),则不会发生任何事情"
},
"rename_note": {
"rename_note_title_to": "重命名笔记标题为:",
"new_note_title": "新笔记标题",
"click_help_icon": "点击右侧的帮助图标查看所有选项",
"evaluated_as_js_string": "给定的值被评估为JavaScript字符串因此可以通过注入的<code>note</code>变量(正在重命名的笔记)丰富动态内容。 例如:",
"example_note": "<code>Note</code> - 所有匹配的笔记都被重命名为“Note”",
"example_new_title": "<code>NEW: ${note.title}</code> - 匹配的笔记标题以“NEW: ”为前缀",
"example_date_prefix": "<code>${note.dateCreatedObj.format('MM-DD:')}: ${note.title}</code> - 匹配的笔记以笔记的创建月份-日期为前缀",
"api_docs": "有关详细信息,请参阅<a href='https://zadam.github.io/trilium/backend_api/Note.html'>笔记</a>及其<a href='https://day.js.org/docs/en/display/format'>dateCreatedObj / utcDateCreatedObj 属性</a>的API文档。"
}
}

View File

@ -442,5 +442,34 @@
"new_value_placeholder": "new value",
"help_text": "On all matched notes, change value of the existing label.",
"help_text_note": "You can also call this method without value, in such case label will be assigned to the note without value."
},
"delete_note": {
"delete_matched_notes": "Delete matched notes",
"delete_matched_notes_description": "This will delete matched notes.",
"undelete_notes_instruction": "After the deletion, it's possible to undelete them from Recent Changes dialog.",
"erase_notes_instruction": "To erase notes permanently, you can go after the deletion to the Option -> Other and click the \"Erase deleted notes now\" button."
},
"delete_revisions": {
"delete_note_revisions": "Delete note revisions",
"all_past_note_revisions": "All past note revisions of matched notes will be deleted. Note itself will be fully preserved. In other terms, note's history will be removed."
},
"move_note": {
"move_note": "Move note",
"to": "to",
"target_parent_note": "target parent note",
"on_all_matched_notes": "On all matched notes",
"move_note_new_parent": "move note to the new parent if note has only one parent (i.e. the old placement is removed and new placement into the new parent is created)",
"clone_note_new_parent": "clone note to the new parent if note has multiple clones/placements (it's not clear which placement should be removed)",
"nothing_will_happen": "nothing will happen if note cannot be moved to the target note (i.e. this would create a tree cycle)"
},
"rename_note": {
"rename_note_title_to": "Rename note title to:",
"new_note_title": "new note title",
"click_help_icon": "Click help icon on the right to see all the options",
"evaluated_as_js_string": "The given value is evaluated as JavaScript string and thus can be enriched with dynamic content via the injected <code>note</code> variable (note being renamed). Examples:",
"example_note": "<code>Note</code> - all matched notes are renamed to 'Note'",
"example_new_title": "<code>NEW: ${note.title}</code> - matched notes titles are prefixed with 'NEW: '",
"example_date_prefix": "<code>${note.dateCreatedObj.format('MM-DD:')}: ${note.title}</code> - matched notes are prefixed with note's creation month-date",
"api_docs": "See API docs for <a href='https://zadam.github.io/trilium/backend_api/Note.html'>note</a> and its <a href='https://day.js.org/docs/en/display/format'>dateCreatedObj / utcDateCreatedObj properties</a> for details."
}
}