add translation for bulk action and script execute

This commit is contained in:
Nriver 2024-07-29 10:23:32 +08:00
parent 92b0c7f0b7
commit bcf892ca37
4 changed files with 26 additions and 6 deletions

View File

@ -1,3 +1,4 @@
import { t } from "../../services/i18n.js";
import server from "../../services/server.js";
import ws from "../../services/ws.js";
import utils from "../../services/utils.js";
@ -14,7 +15,7 @@ export default class AbstractBulkAction {
$rendered.find('.action-conf-del')
.on('click', () => this.deleteAction())
.attr('title', 'Remove this search action');
.attr('title', t('abstract_bulk_action.remove_this_search_action'));
utils.initHelpDropdown($rendered);

View File

@ -1,10 +1,11 @@
import { t } from "../../services/i18n.js";
import SpacedUpdate from "../../services/spaced_update.js";
import AbstractBulkAction from "./abstract_bulk_action.js";
const TPL = `
<tr>
<td>
Execute script:
${t('execute_script.execute_script')}
</td>
<td>
<input type="text"
@ -16,13 +17,13 @@ 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">
You can execute simple scripts on the matched notes.
${t('execute_script.help_text')}
For example to append a string to a note's title, use this small script:
${t('execute_script.example_1')}
<pre>note.title = note.title + ' - suffix';</pre>
More complex example would be deleting all matched note's attributes:
${t('execute_script.example_2')}
<pre>for (const attr of note.getOwnedAttributes) { attr.markAsDeleted(); }</pre>
</div>

View File

@ -395,11 +395,20 @@
"help_text_body1": "要添加标签,只需输入例如 <code>#rock</code> 或者如果您还想添加值,则例如 <code>#year = 2020</code>",
"help_text_body2": "对于关系,请输入 <code>~author = @</code>,这将显示一个自动完成列表,您可以查找所需的笔记。",
"help_text_body3": "您也可以使用右侧的 <code>+</code> 按钮添加标签和关系。</p>",
"save_attributes": "报错属性 <enter>",
"save_attributes": "保存属性 <enter>",
"add_a_new_attribute": "添加新属性",
"add_new_label": "添加新标签 <kbd data-command=\"addNewLabel\"></kbd>",
"add_new_relation": "添加新关系 <kbd data-command=\"addNewRelation\"></kbd>",
"add_new_label_definition": "添加新标签定义",
"add_new_relation_definition": "添加新关系定义"
},
"abstract_bulk_action": {
"remove_this_search_action": "删除此搜索操作"
},
"execute_script": {
"execute_script": "执行脚本",
"help_text": "您可以在匹配的笔记上执行简单的脚本。",
"example_1": "例如,要在笔记标题后附加字符串,请使用以下脚本:",
"example_2": "更复杂的例子,删除所有匹配的笔记属性:"
}
}

View File

@ -401,5 +401,14 @@
"add_new_relation": "Add new relation <kbd data-command=\"addNewRelation\"></kbd>",
"add_new_label_definition": "Add new label definition",
"add_new_relation_definition": "Add new relation definition"
},
"abstract_bulk_action": {
"remove_this_search_action": "Remove this search action"
},
"execute_script": {
"execute_script": "Execute script",
"help_text": "You can execute simple scripts on the matched notes.",
"example_1": "For example to append a string to a note's title, use this small script:",
"example_2": "More complex example would be deleting all matched note's attributes:"
}
}