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,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);