mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-29 17:26:38 +01:00 
			
		
		
		
	add translation for ribbon widgets: search_definition.js
This commit is contained in:
		| @@ -1,3 +1,4 @@ | |||||||
|  | import { t } from "../../services/i18n.js"; | ||||||
| import server from "../../services/server.js"; | import server from "../../services/server.js"; | ||||||
| import NoteContextAwareWidget from "../note_context_aware_widget.js"; | import NoteContextAwareWidget from "../note_context_aware_widget.js"; | ||||||
| import froca from "../../services/froca.js"; | import froca from "../../services/froca.js"; | ||||||
| @@ -73,54 +74,54 @@ const TPL = ` | |||||||
|     <div class="search-settings"> |     <div class="search-settings"> | ||||||
|         <table class="search-setting-table"> |         <table class="search-setting-table"> | ||||||
|             <tr> |             <tr> | ||||||
|                 <td class="title-column">Add search option:</td> |                 <td class="title-column">${t('search_definition.add_search_option')}</td> | ||||||
|                 <td colspan="2" class="add-search-option"> |                 <td colspan="2" class="add-search-option"> | ||||||
|                     <button type="button" class="btn btn-sm" data-search-option-add="searchString"> |                     <button type="button" class="btn btn-sm" data-search-option-add="searchString"> | ||||||
|                         <span class="bx bx-text"></span>  |                         <span class="bx bx-text"></span>  | ||||||
|                         search string |                         ${t('search_definition.search_string')} | ||||||
|                     </button> |                     </button> | ||||||
|                      |                      | ||||||
|                     <button type="button" class="btn btn-sm" data-search-option-add="searchScript"> |                     <button type="button" class="btn btn-sm" data-search-option-add="searchScript"> | ||||||
|                         <span class="bx bx-code"></span>  |                         <span class="bx bx-code"></span>  | ||||||
|                         search script |                         ${t('search_definition.search_script')} | ||||||
|                     </button> |                     </button> | ||||||
|                      |                      | ||||||
|                     <button type="button" class="btn btn-sm" data-search-option-add="ancestor"> |                     <button type="button" class="btn btn-sm" data-search-option-add="ancestor"> | ||||||
|                         <span class="bx bx-filter-alt"></span>  |                         <span class="bx bx-filter-alt"></span>  | ||||||
|                         ancestor |                         ${t('search_definition.ancestor')} | ||||||
|                     </button> |                     </button> | ||||||
|                      |                      | ||||||
|                     <button type="button" class="btn btn-sm" data-search-option-add="fastSearch" |                     <button type="button" class="btn btn-sm" data-search-option-add="fastSearch" | ||||||
|                         title="Fast search option disables full text search of note contents which might speed up searching in large databases."> |                         title="${t('search_definition.fast_search_description')}"> | ||||||
|                         <span class="bx bx-run"></span> |                         <span class="bx bx-run"></span> | ||||||
|                         fast search |                         ${t('search_definition.fast_search')} | ||||||
|                     </button> |                     </button> | ||||||
|                      |                      | ||||||
|                     <button type="button" class="btn btn-sm" data-search-option-add="includeArchivedNotes" |                     <button type="button" class="btn btn-sm" data-search-option-add="includeArchivedNotes" | ||||||
|                         title="Archived notes are by default excluded from search results, with this option they will be included."> |                         title="${t('search_definition.include_archived_notes_description')}"> | ||||||
|                         <span class="bx bx-archive"></span> |                         <span class="bx bx-archive"></span> | ||||||
|                         include archived |                         ${t('search_definition.include_archived')} | ||||||
|                     </button> |                     </button> | ||||||
|                      |                      | ||||||
|                     <button type="button" class="btn btn-sm" data-search-option-add="orderBy"> |                     <button type="button" class="btn btn-sm" data-search-option-add="orderBy"> | ||||||
|                         <span class="bx bx-arrow-from-top"></span> |                         <span class="bx bx-arrow-from-top"></span> | ||||||
|                         order by |                         ${t('search_definition.order_by')} | ||||||
|                     </button> |                     </button> | ||||||
|                      |                      | ||||||
|                     <button type="button" class="btn btn-sm" data-search-option-add="limit" title="Limit number of results"> |                     <button type="button" class="btn btn-sm" data-search-option-add="limit" title="${t('search_definition.limit_description')}"> | ||||||
|                         <span class="bx bx-stop"></span> |                         <span class="bx bx-stop"></span> | ||||||
|                         limit |                         ${t('search_definition.limit')} | ||||||
|                     </button> |                     </button> | ||||||
|                      |                      | ||||||
|                     <button type="button" class="btn btn-sm" data-search-option-add="debug" title="Debug will print extra debugging information into the console to aid in debugging complex queries"> |                     <button type="button" class="btn btn-sm" data-search-option-add="debug" title="${t('search_definition.debug_description')}"> | ||||||
|                         <span class="bx bx-bug"></span> |                         <span class="bx bx-bug"></span> | ||||||
|                         debug |                         ${t('search_definition.debug')} | ||||||
|                     </button> |                     </button> | ||||||
|                      |                      | ||||||
|                     <div class="dropdown" style="display: inline-block;"> |                     <div class="dropdown" style="display: inline-block;"> | ||||||
|                       <button class="btn btn-sm dropdown-toggle action-add-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |                       <button class="btn btn-sm dropdown-toggle action-add-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||||||
|                         <span class="bx bxs-zap"></span> |                         <span class="bx bxs-zap"></span> | ||||||
|                         action |                         ${t('search_definition.action')} | ||||||
|                       </button> |                       </button> | ||||||
|                       <div class="dropdown-menu action-list"></div> |                       <div class="dropdown-menu action-list"></div> | ||||||
|                     </div> |                     </div> | ||||||
| @@ -134,19 +135,19 @@ const TPL = ` | |||||||
|                         <div style="display: flex; justify-content: space-evenly"> |                         <div style="display: flex; justify-content: space-evenly"> | ||||||
|                             <button type="button" class="btn btn-sm search-button"> |                             <button type="button" class="btn btn-sm search-button"> | ||||||
|                                 <span class="bx bx-search"></span> |                                 <span class="bx bx-search"></span> | ||||||
|                                 Search |                                 ${t('search_definition.search')} | ||||||
|                                  |                                  | ||||||
|                                 <kbd>enter</kbd> |                                 <kbd>${t('search_definition.enter')}</kbd> | ||||||
|                             </button> |                             </button> | ||||||
|          |          | ||||||
|                             <button type="button" class="btn btn-sm search-and-execute-button"> |                             <button type="button" class="btn btn-sm search-and-execute-button"> | ||||||
|                                 <span class="bx bxs-zap"></span> |                                 <span class="bx bxs-zap"></span> | ||||||
|                                 Search & Execute actions |                                 ${t('search_definition.search_execute')} | ||||||
|                             </button> |                             </button> | ||||||
|                              |                              | ||||||
|                             <button type="button" class="btn btn-sm save-to-note-button"> |                             <button type="button" class="btn btn-sm save-to-note-button"> | ||||||
|                                 <span class="bx bx-save"></span> |                                 <span class="bx bx-save"></span> | ||||||
|                                 Save to note |                                 ${t('search_definition.save_to_note')} | ||||||
|                             </button> |                             </button> | ||||||
|                         </div> |                         </div> | ||||||
|                     </td> |                     </td> | ||||||
| @@ -180,7 +181,7 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget { | |||||||
|         return { |         return { | ||||||
|             show: this.isEnabled(), |             show: this.isEnabled(), | ||||||
|             activate: true, |             activate: true, | ||||||
|             title: 'Search Parameters', |             title: t('search_definition.search_parameters'), | ||||||
|             icon: 'bx bx-search' |             icon: 'bx bx-search' | ||||||
|         }; |         }; | ||||||
|     } |     } | ||||||
| @@ -198,7 +199,7 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget { | |||||||
|                 this.$actionList.append( |                 this.$actionList.append( | ||||||
|                     $('<a class="dropdown-item" href="#">') |                     $('<a class="dropdown-item" href="#">') | ||||||
|                         .attr('data-action-add', action.actionName) |                         .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); |                 await clazz.create(this.noteId); | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|                 logError(`Unknown search option ${searchOptionName}`); |                 logError(t('search_definition.unknown_search_option', { searchOptionName })); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             this.refresh(); |             this.refresh(); | ||||||
| @@ -243,8 +244,9 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget { | |||||||
|             await ws.waitForMaxKnownEntityChangeId(); |             await ws.waitForMaxKnownEntityChangeId(); | ||||||
|  |  | ||||||
|             await appContext.tabManager.getActiveContext().setNote(notePath); |             await appContext.tabManager.getActiveContext().setNote(notePath); | ||||||
|  |             // Note the {{- notePathTitle}} in json file is not typo, it's unescaping | ||||||
|             toastService.showMessage(`Search note has been saved into ${await treeService.getNotePathTitle(notePath)}`); |             // 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'); |         this.triggerCommand('refreshResults'); | ||||||
|  |  | ||||||
|         toastService.showMessage('Actions have been executed.', 3000); |         toastService.showMessage(t('search_definition.actions_executed'), 3000); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     entitiesReloadedEvent({loadResults}) { |     entitiesReloadedEvent({loadResults}) { | ||||||
|   | |||||||
| @@ -752,5 +752,29 @@ | |||||||
|         "script": "脚本", |         "script": "脚本", | ||||||
|         "execute_query": "执行查询", |         "execute_query": "执行查询", | ||||||
|         "execute_script": "执行脚本" |         "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": "操作已执行。" | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -753,5 +753,29 @@ | |||||||
|         "script": "Script", |         "script": "Script", | ||||||
|         "execute_query": "Execute Query", |         "execute_query": "Execute Query", | ||||||
|         "execute_script": "Execute Script" |         "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." | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user