How eeexun/gtt works
Project type and purpose
• This is a command-line TUI (Text User Interface) translation tool written in Go, named “gtt.”
• Purpose: Let users translate text between languages using multiple back-end services (Google, Bing, DeepL, ChatGPT, etc.) in a unified TUI.
File structure
• Top level
• main.go – entry point
• config.go, utils.go, key.go, ui.go – orchestrate config loading, keybindings, UI loops, helpers
• build/ & .github/ – Dockerfile, CI/CD workflows, packaging
• example/ – sample YAML configs for keymaps, server (API keys), themes
• internal/
• translate/
– core/ – shared translation logic (language definitions, server config, TTS)
– [apertium, bing, chatgpt, deepl, google, libre, reverso] – adapter implementations for each service
– translator.go – higher-level orchestration over all adapters
• go.mod, go.sum – Go modules
README for additional insights
• Lists supported translators and any special config requirements (API keys, hosts).
• Describes how to provide keymaps and theme via YAML in user’s XDG_CONFIG_HOME.
• Shows optional dependencies (xclip/wl-clipboard).
• Mentions Docker, AUR, nix, binary releases, build flags.
Elements
• UI layer (e.g., blue rectangle)
• Core & adapters (e.g., green rectangles)
• Protocols (HTTP/REST) and file formats (YAML)
Additional notes
• Optional Clipboard & TTS modules as side branches from the UI layer.
• Don’t over-engineer—focus on the four main tiers (UI, Core, Adapters, External) and config/style cross-cutting concerns.
• Use consistent iconography and grouping to make layers immediately recognizable.