翻译模块
This commit is contained in:
+61
-3
@@ -12,9 +12,11 @@ mod osd_window;
|
||||
mod process_manager;
|
||||
mod quickpanel;
|
||||
mod screenshot;
|
||||
mod secrets;
|
||||
mod setup;
|
||||
mod shortcut;
|
||||
mod snap_fix;
|
||||
mod translate;
|
||||
mod tray_menu;
|
||||
mod updater;
|
||||
mod win32_util;
|
||||
@@ -101,6 +103,18 @@ use quickpanel::{
|
||||
quickpanel_show_window, quickpanel_unregister_shortcut, quickpanel_focus_main_window,
|
||||
};
|
||||
use tray_menu::{tray_menu_action, tray_menu_hide, tray_menu_ready};
|
||||
use translate::{
|
||||
translate_abort, translate_apply_shortcuts, translate_copy_text, translate_engine_delete,
|
||||
translate_engine_models, translate_engine_save, translate_engine_test_config,
|
||||
translate_engines_list,
|
||||
translate_get_settings, translate_history_clear, translate_history_delete,
|
||||
translate_history_list, translate_history_set_favorited, translate_ocr_languages,
|
||||
translate_paste_back, translate_popup_edit_mode, translate_popup_hide,
|
||||
translate_popup_prefs_set, translate_popup_ready, translate_popup_resize,
|
||||
translate_popup_set_pinned, translate_preview_popup, translate_run, translate_save_settings,
|
||||
translate_screenshot_region, translate_secret_clear, translate_secret_set,
|
||||
translate_stream_start,
|
||||
};
|
||||
use updater::{
|
||||
app_version, update_check, update_install, update_thinghk_apply, update_thinghk_cancel,
|
||||
update_thinghk_confirm, ThinghkUpdateState,
|
||||
@@ -113,11 +127,16 @@ fn quit_app(app: tauri::AppHandle) {
|
||||
}
|
||||
|
||||
/// 导出 tauri-specta 生成的 TypeScript 类型与命令绑定(仅 debug 构建,开发时自动刷新)。
|
||||
/// 覆盖 proxy / quickpanel / clipboard / download_engine / screenshot 五个模块;
|
||||
/// 覆盖 proxy / quickpanel / clipboard / download_engine / screenshot / translate 等模块;
|
||||
/// 豁免清单(返回 serde_json::Value 或 tauri::ipc::Response/Request,specta 无法生成):
|
||||
/// proxy_version / proxy_get_proxies / proxy_get_connections / proxy_patch_configs、
|
||||
/// downloader_status / downloader_get_extension_info、
|
||||
/// screenshot_get_fullscreen_bmp(返回 ipc::Response)/ screenshot_compose_copy(接收 ipc::Request)。
|
||||
/// screenshot_get_fullscreen_bmp(返回 ipc::Response)/ screenshot_compose_copy(接收 ipc::Request)、
|
||||
/// music_ping / music_get_sources / music_search(返回 serde_json::Value)。
|
||||
///
|
||||
/// 注意:export 结果写入 `../src/lib/bindings.ts`,因此**新增模块的命令后需至少以 debug
|
||||
/// 构建运行一次**,前端才能用 `commands.xxx` 拿到类型。在此之前前端若需调用,
|
||||
/// 只能退回原生 `invoke`(返回类型需自行声明)。
|
||||
#[cfg(debug_assertions)]
|
||||
fn export_bindings() {
|
||||
use specta_typescript::Typescript;
|
||||
@@ -178,6 +197,17 @@ fn export_bindings() {
|
||||
screenshot_set_scroll_hole,
|
||||
screenshot_copy_image, screenshot_save_png,
|
||||
screenshot_save_cache, screenshot_load_cache, screenshot_delete_cache,
|
||||
// translate(20)
|
||||
translate_get_settings, translate_save_settings, translate_apply_shortcuts,
|
||||
translate_engines_list, translate_engine_save, translate_engine_delete,
|
||||
translate_secret_set, translate_secret_clear, translate_engine_test_config,
|
||||
translate_engine_models, translate_run, translate_copy_text,
|
||||
translate_preview_popup, translate_popup_ready, translate_popup_hide,
|
||||
translate_popup_edit_mode, translate_popup_set_pinned, translate_popup_prefs_set,
|
||||
translate_popup_resize, translate_screenshot_region, translate_ocr_languages,
|
||||
translate_history_list, translate_history_delete, translate_history_clear,
|
||||
translate_history_set_favorited,
|
||||
translate_stream_start, translate_abort, translate_paste_back,
|
||||
])
|
||||
.export(Typescript::default(), "../src/lib/bindings.ts")
|
||||
.expect("failed to export bindings");
|
||||
@@ -415,7 +445,35 @@ pub fn run() {
|
||||
screenshot_unregister_pin_shortcut,
|
||||
screenshot_disable_transitions,
|
||||
screenshot_compose_copy,
|
||||
screenshot_compose_png
|
||||
screenshot_compose_png,
|
||||
translate_get_settings,
|
||||
translate_save_settings,
|
||||
translate_apply_shortcuts,
|
||||
translate_engines_list,
|
||||
translate_engine_save,
|
||||
translate_engine_delete,
|
||||
translate_secret_set,
|
||||
translate_secret_clear,
|
||||
translate_engine_test_config,
|
||||
translate_engine_models,
|
||||
translate_run,
|
||||
translate_copy_text,
|
||||
translate_preview_popup,
|
||||
translate_popup_ready,
|
||||
translate_popup_hide,
|
||||
translate_popup_edit_mode,
|
||||
translate_popup_set_pinned,
|
||||
translate_popup_prefs_set,
|
||||
translate_popup_resize,
|
||||
translate_screenshot_region,
|
||||
translate_ocr_languages,
|
||||
translate_history_list,
|
||||
translate_history_delete,
|
||||
translate_history_clear,
|
||||
translate_history_set_favorited,
|
||||
translate_stream_start,
|
||||
translate_abort,
|
||||
translate_paste_back
|
||||
])
|
||||
.setup(setup::init)
|
||||
.on_window_event(|window, event| {
|
||||
|
||||
Reference in New Issue
Block a user