# lamvu211/direct-trans architecture

> Architecture diagram of the GitHub repository lamvu211/direct-trans, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lamvu211/direct-trans
- Repository: https://github.com/lamvu211/direct-trans

## Overview

DirectTrans is a Windows tray application that translates selected text through configured AI or Google Translate providers, then displays the result or replaces the selection. Its principal workflow is global-hotkey handling, selection capture, translation, and popup/replacement. Settings cover providers, API keys, themes, language, hotkeys, startup, updates, and feedback. The graph reflects README-described capabilities and relationships listed in the source index; unsampled runtime details are not assumed.

Main entry points: [`src/ui/qt/settings_window.py`](https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/settings_window.py) (Settings window), [`src/main.py`](https://github.com/lamvu211/direct-trans/blob/main/src/main.py) (App coordinator), [`src/ui/qt/popup_window.py`](https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/popup_window.py) (Translation popup), [`src/translator.py`](https://github.com/lamvu211/direct-trans/blob/main/src/translator.py) (Translation providers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Translation workflow"]
  node_app["App coordinator<br/>[main.py]"]
  node_hotkeys["Global hotkeys<br/>[hotkey_manager.py]"]
  node_clipboard["Selection and RTF<br/>[clipboard_util.py]"]
  node_translator["Translation providers<br/>[translator.py]"]
end

subgraph group_configuration["Settings and preferences"]
  node_config[("App configuration<br/>[config.py]")]
  node_api["Provider settings<br/>[api_section.py]"]
  node_hotkey_editor["Hotkey management"]
  node_hotkey_dialog["Hotkey editor dialog<br/>[hotkey_dialog.py]"]
end

subgraph group_interface["User interface"]
  node_result["Translation popup<br/>[popup_window.py]"]
  node_settings["Settings window<br/>[settings_window.py]"]
  node_tray["System tray<br/>[tray.py]"]
  node_theme["Theme registry<br/>[theme.py]"]
  node_i18n["UI translations<br/>[i18n.py]"]
  node_font["Font mapping<br/>[font_mapper.py]"]
end

subgraph group_services["Integrations and support"]
  node_updater["Update checker<br/>[updater.py]"]
  node_feedback["Feedback helper<br/>[feedback_util.py]"]
  node_providers{{"Translation services"}}
end

node_user(("Desktop user"))

node_user -->|"presses hotkey"| node_hotkeys
node_hotkeys -->|"triggers callback"| node_app
node_app -->|"captures selection"| node_clipboard
node_app -->|"requests translation"| node_translator
node_translator -.->|"sends request"| node_providers
node_app -->|"shows result"| node_result
node_result -->|"replaces selection"| node_clipboard
node_user -->|"opens settings"| node_settings
node_tray -->|"opens settings"| node_settings
node_settings -->|"builds section"| node_api
node_settings -->|"manages hotkeys"| node_hotkey_editor
node_hotkey_editor -->|"opens editor"| node_hotkey_dialog
node_settings -->|"saves preferences"| node_config
node_api -->|"tests provider"| node_translator
node_settings -->|"applies theme"| node_theme
node_settings -->|"loads translations"| node_i18n
node_result -->|"applies theme"| node_theme
node_result -->|"maps fonts"| node_font
node_settings -->|"checks updates"| node_updater
node_settings -->|"opens feedback"| node_feedback

click node_app "https://github.com/lamvu211/direct-trans/blob/main/src/main.py"
click node_hotkeys "https://github.com/lamvu211/direct-trans/blob/main/src/hotkey_manager.py"
click node_clipboard "https://github.com/lamvu211/direct-trans/blob/main/src/clipboard_util.py"
click node_translator "https://github.com/lamvu211/direct-trans/blob/main/src/translator.py"
click node_result "https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/popup_window.py"
click node_settings "https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/settings_window.py"
click node_tray "https://github.com/lamvu211/direct-trans/blob/main/src/tray.py"
click node_config "https://github.com/lamvu211/direct-trans/blob/main/src/config.py"
click node_api "https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/api_section.py"
click node_hotkey_editor "https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/hotkey_manage_dialog.py"
click node_hotkey_dialog "https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/hotkey_dialog.py"
click node_theme "https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/theme.py"
click node_i18n "https://github.com/lamvu211/direct-trans/blob/main/src/ui/i18n.py"
click node_font "https://github.com/lamvu211/direct-trans/blob/main/src/font_mapper.py"
click node_updater "https://github.com/lamvu211/direct-trans/blob/main/src/updater.py"
click node_feedback "https://github.com/lamvu211/direct-trans/blob/main/src/feedback_util.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_hotkeys,node_clipboard,node_translator,node_user toneBlue
class node_config,node_api,node_hotkey_editor,node_hotkey_dialog toneAmber
class node_result,node_settings,node_tray,node_theme,node_i18n,node_font toneMint
class node_updater,node_feedback,node_providers toneRose
```

## Components

### Translation workflow

- [App coordinator](https://github.com/lamvu211/direct-trans/blob/main/src/main.py): `src/main.py`
- [Global hotkeys](https://github.com/lamvu211/direct-trans/blob/main/src/hotkey_manager.py): `src/hotkey_manager.py`
- [Selection and RTF](https://github.com/lamvu211/direct-trans/blob/main/src/clipboard_util.py): `src/clipboard_util.py`
- [Translation providers](https://github.com/lamvu211/direct-trans/blob/main/src/translator.py): `src/translator.py`

### Settings and preferences

- [App configuration](https://github.com/lamvu211/direct-trans/blob/main/src/config.py): `src/config.py`
- [Provider settings](https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/api_section.py): `src/ui/qt/api_section.py`
- [Hotkey management](https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/hotkey_manage_dialog.py): `src/ui/qt/hotkey_manage_dialog.py`
- [Hotkey editor dialog](https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/hotkey_dialog.py): `src/ui/qt/hotkey_dialog.py`

### User interface

- [Translation popup](https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/popup_window.py): `src/ui/qt/popup_window.py`
- [Settings window](https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/settings_window.py): `src/ui/qt/settings_window.py`
- [System tray](https://github.com/lamvu211/direct-trans/blob/main/src/tray.py): `src/tray.py`
- [Theme registry](https://github.com/lamvu211/direct-trans/blob/main/src/ui/qt/theme.py): `src/ui/qt/theme.py`
- [UI translations](https://github.com/lamvu211/direct-trans/blob/main/src/ui/i18n.py): `src/ui/i18n.py`
- [Font mapping](https://github.com/lamvu211/direct-trans/blob/main/src/font_mapper.py): `src/font_mapper.py`

### Integrations and support

- [Update checker](https://github.com/lamvu211/direct-trans/blob/main/src/updater.py): `src/updater.py`
- [Feedback helper](https://github.com/lamvu211/direct-trans/blob/main/src/feedback_util.py): `src/feedback_util.py`
- **Translation services**

### Other components

- **Desktop user**

## Connections

- Desktop user → Global hotkeys: presses hotkey (evidence: `README.md`)
- Global hotkeys → App coordinator: triggers callback (evidence: `src/hotkey_manager.py`)
- App coordinator → Selection and RTF: captures selection (evidence: `README.md`)
- App coordinator → Translation providers: requests translation (evidence: `README.md`)
- Translation providers → Translation services: sends request (evidence: `README.md`)
- App coordinator → Translation popup: shows result (evidence: `README.md`)
- Translation popup → Selection and RTF: replaces selection (evidence: `src/ui/qt/popup_window.py`)
- Desktop user → Settings window: opens settings (evidence: `README.md`)
- System tray → Settings window: opens settings (evidence: `README.md`)
- Settings window → Provider settings: builds section (evidence: `src/ui/qt/settings_window.py`)
- Settings window → Hotkey management: manages hotkeys (evidence: `src/ui/qt/settings_window.py`)
- Hotkey management → Hotkey editor dialog: opens editor (evidence: `src/ui/qt/hotkey_manage_dialog.py`)
- Settings window → App configuration: saves preferences (evidence: `src/ui/qt/settings_window.py`)
- Provider settings → Translation providers: tests provider (evidence: `src/ui/qt/api_section.py`)
- Settings window → Theme registry: applies theme (evidence: `src/ui/qt/settings_window.py`)
- Settings window → UI translations: loads translations (evidence: `src/ui/qt/settings_window.py`)
- Translation popup → Theme registry: applies theme (evidence: `src/ui/qt/popup_window.py`)
- Translation popup → Font mapping: maps fonts (evidence: `src/ui/qt/popup_window.py`)
- Settings window → Update checker: checks updates (evidence: `src/ui/qt/settings_window.py`)
- Settings window → Feedback helper: opens feedback (evidence: `src/ui/qt/settings_window.py`)
