Skip to content

chenxuuu/translate_type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

翻译输入助手 / TranslateType

English | 中文


中文

一款便捷的 Windows 实时翻译工具,支持在任意文本框中按快捷键触发翻译。

截图

功能特点

  • 全局快捷键: 在任意应用的文本框中按快捷键即可触发翻译
  • 🔄 双击触发: 支持双击单键(如双击Ctrl)快速触发翻译
  • 🌐 多翻译引擎: 支持百度翻译、有道翻译、DeepL翻译
  • 🌍 多目标语言: 支持翻译到19种语言(中文简繁体、英语、日语、韩语、法语、德语、西班牙语、俄语、越南语、泰语、印尼语、马来语、葡萄牙语、意大利语、荷兰语、波兰语、阿拉伯语、印地语)
  • 🗣️ 多语言界面: 自动识别系统语言,支持中文、英语、法语、葡萄牙语、日语界面
  • 🖥️ GUI配置界面: 友好的图形界面,轻松配置各项参数
  • 📌 窗口置顶: 可选择窗口置顶显示

使用方法

1. 配置API密钥

首先需要在"API配置"页面配置翻译服务的API密钥:

百度翻译

有道翻译

DeepL翻译

2. 设置快捷键

在"设置"页面可以自定义触发翻译的快捷键:

  • 默认快捷键: Ctrl + Alt + T
  • 支持 Ctrl、Alt、Shift 组合键
  • 支持 A-Z、0-9、F1-F12 等按键
  • 支持双击单键触发(如双击 Ctrl 键)

3. 设置界面语言

在"设置"页面可以选择界面语言:

  • 自动检测(根据系统语言)
  • 手动选择:简体中文、English、Français、Português、日本語

4. 使用翻译

  1. 在任意应用的文本框中输入要翻译的文字
  2. 按下设置的快捷键(或双击触发键)
  3. 等待翻译完成,文本将自动被替换为翻译结果

编译方法

确保已安装 Rust 工具链,然后运行:

cargo build --release

编译后的可执行文件位于 target/release/translate_type.exe

项目结构

src/
├── main.rs        # 主程序入口和GUI
├── config.rs      # 配置管理
├── translator.rs  # 翻译引擎实现
├── hotkey.rs      # 全局快捷键管理
├── clipboard.rs   # 剪贴板和输入模拟
└── i18n.rs        # 国际化/多语言支持

依赖项

  • eframe/egui: GUI框架
  • global-hotkey: 全局快捷键支持
  • arboard: 剪贴板操作
  • reqwest: HTTP请求
  • serde: 序列化/反序列化
  • windows: Windows API
  • directories: 配置文件路径管理

系统要求

  • Windows 10/11
  • 需要网络连接访问翻译API

English

A convenient Windows real-time translation tool that allows you to trigger translation with a hotkey in any text field.

Screenshot

Features

  • Global Hotkey: Trigger translation in any application's text field with a hotkey
  • 🔄 Double-tap Trigger: Support double-tap single key (e.g., double-tap Ctrl) for quick translation
  • 🌐 Multiple Translation Engines: Support Baidu Translate, Youdao Translate, DeepL Translate
  • 🌍 Multiple Target Languages: Support translation to 19 languages (Simplified/Traditional Chinese, English, Japanese, Korean, French, German, Spanish, Russian, Vietnamese, Thai, Indonesian, Malay, Portuguese, Italian, Dutch, Polish, Arabic, Hindi)
  • 🗣️ Multi-language UI: Automatic system language detection, supports Chinese, English, French, Portuguese, Japanese interfaces
  • 🖥️ GUI Configuration: User-friendly graphical interface for easy configuration
  • 📌 Always on Top: Optional window always-on-top display

Usage

1. Configure API Keys

First, configure the translation service API keys in the "API Config" page:

Baidu Translate

Youdao Translate

DeepL Translate

2. Set Hotkey

Customize the translation trigger hotkey in the "Settings" page:

  • Default hotkey: Ctrl + Alt + T
  • Support Ctrl, Alt, Shift modifiers
  • Support A-Z, 0-9, F1-F12 keys
  • Support double-tap single key trigger (e.g., double-tap Ctrl)

3. Set UI Language

Select the interface language in the "Settings" page:

  • Auto detect (based on system language)
  • Manual selection: 简体中文, English, Français, Português, 日本語

4. Use Translation

  1. Type the text you want to translate in any application's text field
  2. Press the configured hotkey (or double-tap the trigger key)
  3. Wait for translation to complete, the text will be automatically replaced with the translation result

Build

Make sure you have the Rust toolchain installed, then run:

cargo build --release

The compiled executable is located at target/release/translate_type.exe

Project Structure

src/
├── main.rs        # Main entry and GUI
├── config.rs      # Configuration management
├── translator.rs  # Translation engine implementation
├── hotkey.rs      # Global hotkey management
├── clipboard.rs   # Clipboard and input simulation
└── i18n.rs        # Internationalization/multi-language support

Dependencies

  • eframe/egui: GUI framework
  • global-hotkey: Global hotkey support
  • arboard: Clipboard operations
  • reqwest: HTTP requests
  • serde: Serialization/deserialization
  • windows: Windows API
  • directories: Config file path management

System Requirements

  • Windows 10/11
  • Network connection required to access translation APIs

License / 许可证

MIT License

About

翻译输入框里的文字。translate all text from text block. 完全由AI编写。 AI write code.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages