diff --git a/src/public/app/widgets/ribbon_widgets/search_definition.js b/src/public/app/widgets/ribbon_widgets/search_definition.js
index 5d2afec4b..b766e69c7 100644
--- a/src/public/app/widgets/ribbon_widgets/search_definition.js
+++ b/src/public/app/widgets/ribbon_widgets/search_definition.js
@@ -1,3 +1,4 @@
+import { t } from "../../services/i18n.js";
import server from "../../services/server.js";
import NoteContextAwareWidget from "../note_context_aware_widget.js";
import froca from "../../services/froca.js";
@@ -73,54 +74,54 @@ const TPL = `
- Add search option: |
+ ${t('search_definition.add_search_option')} |
- |
@@ -180,7 +181,7 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget {
return {
show: this.isEnabled(),
activate: true,
- title: 'Search Parameters',
+ title: t('search_definition.search_parameters'),
icon: 'bx bx-search'
};
}
@@ -198,7 +199,7 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget {
this.$actionList.append(
$('')
.attr('data-action-add', action.actionName)
- .text(action.actionTitle)
+ .text(t(`${action.actionTitle}`))
);
}
}
@@ -211,7 +212,7 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget {
await clazz.create(this.noteId);
}
else {
- logError(`Unknown search option ${searchOptionName}`);
+ logError(t('search_definition.unknown_search_option', { searchOptionName }));
}
this.refresh();
@@ -243,8 +244,9 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget {
await ws.waitForMaxKnownEntityChangeId();
await appContext.tabManager.getActiveContext().setNote(notePath);
-
- toastService.showMessage(`Search note has been saved into ${await treeService.getNotePathTitle(notePath)}`);
+ // Note the {{- notePathTitle}} in json file is not typo, it's unescaping
+ // See https://www.i18next.com/translation-function/interpolation#unescape
+ toastService.showMessage(t('search_definition.search_note_saved', { notePathTitle: await treeService.getNotePathTitle(notePath) }));
});
}
@@ -307,7 +309,7 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget {
this.triggerCommand('refreshResults');
- toastService.showMessage('Actions have been executed.', 3000);
+ toastService.showMessage(t('search_definition.actions_executed'), 3000);
}
entitiesReloadedEvent({loadResults}) {
diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.json
index c1fc35339..1daa8968a 100644
--- a/src/public/translations/cn/translation.json
+++ b/src/public/translations/cn/translation.json
@@ -752,5 +752,29 @@
"script": "脚本",
"execute_query": "执行查询",
"execute_script": "执行脚本"
+ },
+ "search_definition": {
+ "add_search_option": "添加搜索选项:",
+ "search_string": "搜索字符串",
+ "search_script": "搜索脚本",
+ "ancestor": "祖先",
+ "fast_search": "快速搜索",
+ "fast_search_description": "快速搜索选项禁用笔记内容的全文搜索,这可能会加速大数据库中的搜索。",
+ "include_archived": "包含归档",
+ "include_archived_notes_description": "归档的笔记默认不包含在搜索结果中,使用此选项将包含它们。",
+ "order_by": "排序方式",
+ "limit": "限制",
+ "limit_description": "限制结果数量",
+ "debug": "调试",
+ "debug_description": "调试将打印额外的调试信息到控制台,以帮助调试复杂查询",
+ "action": "操作",
+ "search": "搜索",
+ "enter": "输入",
+ "search_execute": "搜索并执行操作",
+ "save_to_note": "保存到笔记",
+ "search_parameters": "搜索参数",
+ "unknown_search_option": "未知的搜索选项 {{searchOptionName}}",
+ "search_note_saved": "搜索笔记已保存到 {{- notePathTitle}}",
+ "actions_executed": "操作已执行。"
}
}
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index 094a5c09e..969e23926 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -753,5 +753,29 @@
"script": "Script",
"execute_query": "Execute Query",
"execute_script": "Execute Script"
+ },
+ "search_definition": {
+ "add_search_option": "Add search option:",
+ "search_string": "search string",
+ "search_script": "search script",
+ "ancestor": "ancestor",
+ "fast_search": "fast search",
+ "fast_search_description": "Fast search option disables full text search of note contents which might speed up searching in large databases.",
+ "include_archived": "include archived",
+ "include_archived_notes_description": "Archived notes are by default excluded from search results, with this option they will be included.",
+ "order_by": "order by",
+ "limit": "limit",
+ "limit_description": "Limit number of results",
+ "debug": "debug",
+ "debug_description": "Debug will print extra debugging information into the console to aid in debugging complex queries",
+ "action": "action",
+ "search": "Search",
+ "enter": "enter",
+ "search_execute": "Search & Execute actions",
+ "save_to_note": "Save to note",
+ "search_parameters": "Search Parameters",
+ "unknown_search_option": "Unknown search option {{searchOptionName}}",
+ "search_note_saved": "Search note has been saved into {{- notePathTitle}}",
+ "actions_executed": "Actions have been executed."
}
}