mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	add translation for shortcuts.js
This commit is contained in:
		| @@ -2,6 +2,7 @@ import server from "../../../services/server.js"; | ||||
| import utils from "../../../services/utils.js"; | ||||
| import dialogService from "../../../services/dialog.js"; | ||||
| import OptionsWidget from "./options_widget.js"; | ||||
| import { t } from "../../../services/i18n.js"; | ||||
|  | ||||
| const TPL = ` | ||||
| <div class="options-section shortcuts-options-section"> | ||||
| @@ -25,25 +26,25 @@ const TPL = ` | ||||
|         } | ||||
|     </style> | ||||
|  | ||||
|     <h4>Keyboard Shortcuts</h4> | ||||
|     <h4>${t('shortcuts.keyboard_shortcuts')}</h4> | ||||
|      | ||||
|     <p> | ||||
|       Multiple shortcuts for the same action can be separated by comma. | ||||
|       See <a href="https://www.electronjs.org/docs/latest/api/accelerator">Electron documentation</a> for available modifiers and key codes. | ||||
|       ${t('shortcuts.multiple_shortcuts')} | ||||
|       ${t('shortcuts.electron_documentation')} | ||||
|     </p> | ||||
|      | ||||
|     <div class="form-group"> | ||||
|         <input type="text" class="keyboard-shortcut-filter form-control" placeholder="Type text to filter shortcuts..."> | ||||
|         <input type="text" class="keyboard-shortcut-filter form-control" placeholder="${t('shortcuts.type_text_to_filter')}"> | ||||
|     </div> | ||||
|      | ||||
|     <div class="shortcuts-table-container"> | ||||
|         <table class="keyboard-shortcut-table" cellpadding="10"> | ||||
|         <thead> | ||||
|             <tr> | ||||
|                 <th>Action name</th> | ||||
|                 <th>Shortcuts</th> | ||||
|                 <th>Default shortcuts</th> | ||||
|                 <th>Description</th> | ||||
|                 <th>${t('shortcuts.action_name')}</th> | ||||
|                 <th>${t('shortcuts.shortcuts')}</th> | ||||
|                 <th>${t('shortcuts.default_shortcuts')}</th> | ||||
|                 <th>${t('shortcuts.description')}</th> | ||||
|             </tr> | ||||
|         </thead> | ||||
|         <tbody></tbody> | ||||
| @@ -51,9 +52,9 @@ const TPL = ` | ||||
|     </div> | ||||
|      | ||||
|     <div class="shortcuts-options-buttons"> | ||||
|         <button class="options-keyboard-shortcuts-reload-app btn btn-primary">Reload app to apply changes</button> | ||||
|         <button class="options-keyboard-shortcuts-reload-app btn btn-primary">${t('shortcuts.reload_app')}</button> | ||||
|          | ||||
|         <button class="options-keyboard-shortcuts-set-all-to-default btn">Set all shortcuts to the default</button> | ||||
|         <button class="options-keyboard-shortcuts-set-all-to-default btn">${t('shortcuts.set_all_to_default')}</button> | ||||
|     </div> | ||||
| </div>`; | ||||
|  | ||||
| @@ -112,7 +113,7 @@ export default class KeyboardShortcutsOptions extends OptionsWidget { | ||||
|         }); | ||||
|  | ||||
|         this.$widget.find(".options-keyboard-shortcuts-set-all-to-default").on('click', async () => { | ||||
|             if (!await dialogService.confirm("Do you really want to reset all keyboard shortcuts to the default?")) { | ||||
|             if (!await dialogService.confirm(t('shortcuts.confirm_reset'))) { | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
| @@ -152,7 +153,7 @@ export default class KeyboardShortcutsOptions extends OptionsWidget { | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 this.$widget.find(el).toggle(!!( // !! to avoid toggle overloads with different behavior | ||||
|                 this.$widget.find(el).toggle(!!( | ||||
|                     action.actionName.toLowerCase().includes(filter) | ||||
|                     || action.defaultShortcuts.some(shortcut => shortcut.toLowerCase().includes(filter)) | ||||
|                     || action.effectiveShortcuts.some(shortcut => shortcut.toLowerCase().includes(filter)) | ||||
|   | ||||
| @@ -1181,5 +1181,18 @@ | ||||
|         "set_password": "设置密码", | ||||
|         "password_mismatch": "新密码不一致。", | ||||
|         "password_changed_success": "密码已更改。按 OK 后 Trilium 将重新加载。" | ||||
|     }, | ||||
|     "shortcuts": { | ||||
|         "keyboard_shortcuts": "快捷键", | ||||
|         "multiple_shortcuts": "同一操作的多个快捷键可以用逗号分隔。", | ||||
|         "electron_documentation": "请参阅 <a href=\"https://www.electronjs.org/docs/latest/api/accelerator\">Electron文档</a>,了解可用的修饰符和键码。", | ||||
|         "type_text_to_filter": "输入文字以过滤快捷键...", | ||||
|         "action_name": "操作名称", | ||||
|         "shortcuts": "快捷键", | ||||
|         "default_shortcuts": "默认快捷键", | ||||
|         "description": "描述", | ||||
|         "reload_app": "重新加载应用以应用更改", | ||||
|         "set_all_to_default": "将所有快捷键重置为默认值", | ||||
|         "confirm_reset": "您确定要将所有键盘快捷键重置为默认值吗?" | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1182,5 +1182,18 @@ | ||||
|         "set_password": "Set Password", | ||||
|         "password_mismatch": "New passwords are not the same.", | ||||
|         "password_changed_success": "Password has been changed. Trilium will be reloaded after you press OK." | ||||
|     }, | ||||
|     "shortcuts": { | ||||
|         "keyboard_shortcuts": "Keyboard Shortcuts", | ||||
|         "multiple_shortcuts": "Multiple shortcuts for the same action can be separated by comma.", | ||||
|         "electron_documentation": "See <a href=\"https://www.electronjs.org/docs/latest/api/accelerator\">Electron documentation</a> for available modifiers and key codes.", | ||||
|         "type_text_to_filter": "Type text to filter shortcuts...", | ||||
|         "action_name": "Action name", | ||||
|         "shortcuts": "Shortcuts", | ||||
|         "default_shortcuts": "Default shortcuts", | ||||
|         "description": "Description", | ||||
|         "reload_app": "Reload app to apply changes", | ||||
|         "set_all_to_default": "Set all shortcuts to the default", | ||||
|         "confirm_reset": "Do you really want to reset all keyboard shortcuts to the default?" | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user