mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	add translation for all floating buttons
This commit is contained in:
		
							parent
							
								
									d93a94322e
								
							
						
					
					
						commit
						71c09b1d67
					
				| @ -1,3 +1,4 @@ | |||||||
|  | import { t } from "../../services/i18n.js"; | ||||||
| import server from "../../services/server.js"; | import server from "../../services/server.js"; | ||||||
| import ws from "../../services/ws.js"; | import ws from "../../services/ws.js"; | ||||||
| import appContext from "../../components/app_context.js"; | import appContext from "../../components/app_context.js"; | ||||||
| @ -15,15 +16,15 @@ const TPL = ` | |||||||
|         } |         } | ||||||
|     </style> |     </style> | ||||||
| 
 | 
 | ||||||
|     <button data-trigger-command="runActiveNote" class="execute-button floating-button btn" title="Execute script"> |     <button data-trigger-command="runActiveNote" class="execute-button floating-button btn" title="${t('code_buttons.execute_button_title')}"> | ||||||
|         <span class="bx bx-run"></span> |         <span class="bx bx-run"></span> | ||||||
|     </button> |     </button> | ||||||
|      |      | ||||||
|     <button class="trilium-api-docs-button floating-button btn" title="Open Trilium API docs"> |     <button class="trilium-api-docs-button floating-button btn" title="${t('code_buttons.trilium_api_docs_button_title')}"> | ||||||
|         <span class="bx bx-help-circle"></span> |         <span class="bx bx-help-circle"></span> | ||||||
|     </button> |     </button> | ||||||
|      |      | ||||||
|     <button class="save-to-note-button floating-button btn"> |     <button class="save-to-note-button floating-button btn" title="${t('code_buttons.save_to_note_button_title')}"> | ||||||
|         <span class="bx bx-save"></span> |         <span class="bx bx-save"></span> | ||||||
|     </button> |     </button> | ||||||
| </div>`; | </div>`; | ||||||
| @ -39,7 +40,7 @@ export default class CodeButtonsWidget extends NoteContextAwareWidget { | |||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|         this.$openTriliumApiDocsButton = this.$widget.find(".trilium-api-docs-button"); |         this.$openTriliumApiDocsButton = this.$widget.find(".trilium-api-docs-button"); | ||||||
|         this.$openTriliumApiDocsButton.on("click", () => { |         this.$openTriliumApiDocsButton.on("click", () => { | ||||||
|             toastService.showMessage("Opening API docs..."); |             toastService.showMessage(t('code_buttons.opening_api_docs_message')); | ||||||
| 
 | 
 | ||||||
|             if (this.note.mime.endsWith("frontend")) { |             if (this.note.mime.endsWith("frontend")) { | ||||||
|                 window.open("https://zadam.github.io/trilium/frontend_api/FrontendScriptApi.html", "_blank"); |                 window.open("https://zadam.github.io/trilium/frontend_api/FrontendScriptApi.html", "_blank"); | ||||||
| @ -58,7 +59,7 @@ export default class CodeButtonsWidget extends NoteContextAwareWidget { | |||||||
| 
 | 
 | ||||||
|             await appContext.tabManager.getActiveContext().setNote(notePath); |             await appContext.tabManager.getActiveContext().setNote(notePath); | ||||||
| 
 | 
 | ||||||
|             toastService.showMessage(`SQL Console note has been saved into ${await treeService.getNotePathTitle(notePath)}`); |             toastService.showMessage(t('code_buttons.sql_console_saved_message', { notePath: await treeService.getNotePathTitle(notePath) })); | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         keyboardActionService.updateDisplayedShortcuts(this.$widget); |         keyboardActionService.updateDisplayedShortcuts(this.$widget); | ||||||
|  | |||||||
| @ -1,3 +1,4 @@ | |||||||
|  | import { t } from "../../services/i18n.js"; | ||||||
| import NoteContextAwareWidget from "../note_context_aware_widget.js"; | import NoteContextAwareWidget from "../note_context_aware_widget.js"; | ||||||
| import utils from "../../services/utils.js"; | import utils from "../../services/utils.js"; | ||||||
| import imageService from "../../services/image.js"; | import imageService from "../../services/image.js"; | ||||||
| @ -5,7 +6,7 @@ import imageService from "../../services/image.js"; | |||||||
| const TPL = ` | const TPL = ` | ||||||
| <button type="button" | <button type="button" | ||||||
|         class="copy-image-reference-button" |         class="copy-image-reference-button" | ||||||
|         title="Copy image reference to the clipboard, can be pasted into a text note."> |         title="${t('copy_image_reference_button.button_title')}"> | ||||||
|         <span class="bx bx-copy"></span> |         <span class="bx bx-copy"></span> | ||||||
|          |          | ||||||
|         <div class="hidden-image-copy"></div> |         <div class="hidden-image-copy"></div> | ||||||
|  | |||||||
| @ -1,3 +1,4 @@ | |||||||
|  | import { t } from "../../services/i18n.js"; | ||||||
| import NoteContextAwareWidget from "../note_context_aware_widget.js"; | import NoteContextAwareWidget from "../note_context_aware_widget.js"; | ||||||
| 
 | 
 | ||||||
| const TPL = ` | const TPL = ` | ||||||
| @ -27,7 +28,7 @@ const TPL = ` | |||||||
| 
 | 
 | ||||||
|     <button type="button" |     <button type="button" | ||||||
|             class="close-floating-buttons-button btn bx bx-x" |             class="close-floating-buttons-button btn bx bx-x" | ||||||
|             title="Hide buttons"></button> |             title="${t('hide_floating_buttons_button.button_title')}"></button> | ||||||
| </div> | </div> | ||||||
| `;
 | `;
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,9 +1,10 @@ | |||||||
|  | import { t } from "../../services/i18n.js"; | ||||||
| import NoteContextAwareWidget from "../note_context_aware_widget.js"; | import NoteContextAwareWidget from "../note_context_aware_widget.js"; | ||||||
| 
 | 
 | ||||||
| const TPL = ` | const TPL = ` | ||||||
| <button type="button" | <button type="button" | ||||||
|         class="export-mermaid-button" |         class="export-mermaid-button" | ||||||
|         title="Export Mermaid diagram as SVG"> |         title="${t('mermaid_export_button.button_title')}"> | ||||||
|         <span class="bx bx-export"></span> |         <span class="bx bx-export"></span> | ||||||
| </button> | </button> | ||||||
| `;
 | `;
 | ||||||
|  | |||||||
| @ -1,3 +1,4 @@ | |||||||
|  | import { t } from "../../services/i18n.js"; | ||||||
| import NoteContextAwareWidget from "../note_context_aware_widget.js"; | import NoteContextAwareWidget from "../note_context_aware_widget.js"; | ||||||
| 
 | 
 | ||||||
| const TPL = ` | const TPL = ` | ||||||
| @ -11,20 +12,20 @@ const TPL = ` | |||||||
| 
 | 
 | ||||||
|     <button type="button" |     <button type="button" | ||||||
|             class="relation-map-create-child-note floating-button btn bx bx-folder-plus" |             class="relation-map-create-child-note floating-button btn bx bx-folder-plus" | ||||||
|             title="Create new child note and add it into this relation map"></button> |             title="${t('relation_map_buttons.create_child_note_title')}"></button> | ||||||
|      |      | ||||||
|     <button type="button" |     <button type="button" | ||||||
|             class="relation-map-reset-pan-zoom floating-button btn bx bx-crop" |             class="relation-map-reset-pan-zoom floating-button btn bx bx-crop" | ||||||
|             title="Reset pan & zoom to initial coordinates and magnification"></button> |             title="${t('relation_map_buttons.reset_pan_zoom_title')}"></button> | ||||||
|      |      | ||||||
|     <div class="btn-group"> |     <div class="btn-group"> | ||||||
|         <button type="button" |         <button type="button" | ||||||
|                 class="relation-map-zoom-in floating-button btn bx bx-zoom-in" |                 class="relation-map-zoom-in floating-button btn bx bx-zoom-in" | ||||||
|                 title="Zoom In"></button> |                 title="${t('relation_map_buttons.zoom_in_title')}"></button> | ||||||
|      |      | ||||||
|         <button type="button" |         <button type="button" | ||||||
|                 class="relation-map-zoom-out floating-button btn bx bx-zoom-out" |                 class="relation-map-zoom-out floating-button btn bx bx-zoom-out" | ||||||
|                 title="Zoom Out"></button> |                 title="${t('relation_map_buttons.zoom_out_title')}"></button> | ||||||
|     </div> |     </div> | ||||||
| </div>`; | </div>`; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ | |||||||
|  * !!! Filename is intentionally mangled, because some adblockers don't like the word "backlinks". |  * !!! Filename is intentionally mangled, because some adblockers don't like the word "backlinks". | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | import { t } from "../../services/i18n.js"; | ||||||
| import NoteContextAwareWidget from "../note_context_aware_widget.js"; | import NoteContextAwareWidget from "../note_context_aware_widget.js"; | ||||||
| import linkService from "../../services/link.js"; | import linkService from "../../services/link.js"; | ||||||
| import server from "../../services/server.js"; | import server from "../../services/server.js"; | ||||||
| @ -100,8 +101,8 @@ export default class BacklinksWidget extends NoteContextAwareWidget { | |||||||
| 
 | 
 | ||||||
|         this.toggle(true); |         this.toggle(true); | ||||||
|         this.$count.text( |         this.$count.text( | ||||||
|             `${resp.count} backlink` |             // i18next plural
 | ||||||
|             + (resp.count === 1 ? '' : 's') |             `${t('zpetne_odkazy.backlink', {count: resp.count})}` | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -138,7 +139,7 @@ export default class BacklinksWidget extends NoteContextAwareWidget { | |||||||
|             })); |             })); | ||||||
| 
 | 
 | ||||||
|             if (backlink.relationName) { |             if (backlink.relationName) { | ||||||
|                 $item.append($("<p>").text(`relation: ${backlink.relationName}`)); |                 $item.append($("<p>").text(`${t('zpetne_odkazy.relation')}: ${backlink.relationName}`)); | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|                 $item.append(...backlink.excerpts); |                 $item.append(...backlink.excerpts); | ||||||
|  | |||||||
| @ -623,5 +623,32 @@ | |||||||
|     }, |     }, | ||||||
|     "note_launcher": { |     "note_launcher": { | ||||||
|         "this_launcher_doesnt_define_target_note": "此启动器未定义目标笔记。" |         "this_launcher_doesnt_define_target_note": "此启动器未定义目标笔记。" | ||||||
|  |     }, | ||||||
|  |     "code_buttons": { | ||||||
|  |         "execute_button_title": "执行脚本", | ||||||
|  |         "trilium_api_docs_button_title": "打开 Trilium API 文档", | ||||||
|  |         "save_to_note_button_title": "保存到笔记", | ||||||
|  |         "opening_api_docs_message": "正在打开 API 文档...", | ||||||
|  |         "sql_console_saved_message": "SQL 控制台已保存到 {{note_path}}" | ||||||
|  |     }, | ||||||
|  |     "copy_image_reference_button": { | ||||||
|  |         "button_title": "复制图片引用到剪贴板,可粘贴到文本笔记中。" | ||||||
|  |     }, | ||||||
|  |     "hide_floating_buttons_button": { | ||||||
|  |         "button_title": "隐藏按钮" | ||||||
|  |     }, | ||||||
|  |     "mermaid_export_button": { | ||||||
|  |         "button_title": "导出Mermaid图表为SVG" | ||||||
|  |     }, | ||||||
|  |     "relation_map_buttons": { | ||||||
|  |         "create_child_note_title": "创建新的子笔记并添加到关系图", | ||||||
|  |         "reset_pan_zoom_title": "重置平移和缩放到初始坐标和放大倍率", | ||||||
|  |         "zoom_in_title": "放大", | ||||||
|  |         "zoom_out_title": "缩小" | ||||||
|  |     }, | ||||||
|  |     "zpetne_odkazy": { | ||||||
|  |         "backlink": "{{count}} 个反链", | ||||||
|  |         "backlinks": "{{count}} 个反链", | ||||||
|  |         "relation": "关系" | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -624,5 +624,32 @@ | |||||||
|     }, |     }, | ||||||
|     "note_launcher": { |     "note_launcher": { | ||||||
|         "this_launcher_doesnt_define_target_note": "This launcher doesn't define target note." |         "this_launcher_doesnt_define_target_note": "This launcher doesn't define target note." | ||||||
|  |     }, | ||||||
|  |     "code_buttons": { | ||||||
|  |         "execute_button_title": "Execute script", | ||||||
|  |         "trilium_api_docs_button_title": "Open Trilium API docs", | ||||||
|  |         "save_to_note_button_title": "Save to note", | ||||||
|  |         "opening_api_docs_message": "Opening API docs...", | ||||||
|  |         "sql_console_saved_message": "SQL Console note has been saved into {{note_path}}" | ||||||
|  |     }, | ||||||
|  |     "copy_image_reference_button": { | ||||||
|  |         "button_title": "Copy image reference to the clipboard, can be pasted into a text note." | ||||||
|  |     }, | ||||||
|  |     "hide_floating_buttons_button": { | ||||||
|  |         "button_title": "Hide buttons" | ||||||
|  |     }, | ||||||
|  |     "mermaid_export_button": { | ||||||
|  |         "button_title": "Export Mermaid diagram as SVG" | ||||||
|  |     }, | ||||||
|  |     "relation_map_buttons": { | ||||||
|  |         "create_child_note_title": "Create new child note and add it into this relation map", | ||||||
|  |         "reset_pan_zoom_title": "Reset pan & zoom to initial coordinates and magnification", | ||||||
|  |         "zoom_in_title": "Zoom In", | ||||||
|  |         "zoom_out_title": "Zoom Out" | ||||||
|  |     }, | ||||||
|  |     "zpetne_odkazy": { | ||||||
|  |         "backlink": "{{count}} Backlink", | ||||||
|  |         "backlinks": "{{count}} Backlinks", | ||||||
|  |         "relation": "relation" | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Nriver
						Nriver