For detailed development information, see
docs/developer-guide.md
This document provides a quick reference to the application's file organization and architecture.
Entry Point (main.py)
↓
Central Coordinator (app_logic.py)
↓
┌─────────────┬─────────────┬─────────────┬─────────────┐
│ Handlers │ Workers │ Utils │ UI │
│ (modular) │ (threads) │ (helpers) │ (interface) │
└─────────────┴─────────────┴─────────────┴─────────────┘
↓
Unified Cache System → File Persistence
- CSV-based model management - All Gemini models configured in
resources/gemini_models.csv - Separate OCR and Translation models - Different models can be selected for each operation
- Automatic cost calculation - Token costs update based on selected models
- Real-time model switching - No application restart required
- Two-tier cache architecture - In-memory LRU cache + persistent file storage
- 40-60% memory reduction compared to previous multi-cache approach
- Thread-safe operations with proper locking mechanisms
- Real-time cost tracking for Gemini API usage (OCR + Translation)
- Detailed logging with token analysis and performance metrics
- Export capabilities for usage statistics and billing analysis
main.py- Application entry pointapp_logic.py- Central coordinator and main application class__init__.py- Package definition
cache_manager.py- File-based translation cache persistenceconfiguration_handler.py- Settings and configuration managementdisplay_manager.py- UI updates for overlays and debug infogemini_models_manager.py- Dynamic Gemini model configuration managementhotkey_handler.py- Keyboard shortcut managementstatistics_handler.py- API usage monitoring and cost trackingtranslation_handler.py- Translation provider coordinationui_interaction_handler.py- User interface interaction management
worker_threads.py- Background threads (capture → OCR → translation)unified_translation_cache.py- LRU cache system for all translation providersmarian_mt_translator.py- Local neural translation implementationconvert_marian.py- HuggingFace model conversion utility (© HuggingFace Team)
ocr_utils.py- OCR processing and text extractiontranslation_utils.py- Translation helper functionslanguage_manager.py- Language code mappings for different servicesconfig_manager.py- Configuration file handlingresource_handler.py- Resource path resolutionresource_copier.py- Resource management for compiled buildslogger.py- Application logging
gui_builder.py- UI construction and tab creationlanguage_ui.py- Multi-language interface supportoverlay_manager.py- Source/target overlay window managementui_elements.py- Custom UI componentsconstants.py- Application constants and language definitions
GameChangingTranslator.spec- PyInstaller spec (CPU-optimized)GameChangingTranslator_GPU.spec- PyInstaller spec (GPU/CUDA-optimized)compile_app.py- Python compilation utilitysetup.py- cx_Freeze setup configurationrequirements.txt- Python dependencies
run.bat- Application launcherinstall_dependencies.bat- Dependency installerrun_python_compiler.bat- Build automation script
ocr_translator_config.ini- User settings (runtime-generated)
resources/
├── Translation APIs
│ ├── google_trans_source.csv / google_trans_target.csv
│ ├── deepl_trans_source.csv / deepl_trans_target.csv
│ ├── gemini_trans_source.csv / gemini_trans_target.csv
│ └── gemini_models.csv # Gemini model configurations and costs
├── MarianMT Models
│ ├── MarianMT_select_models.csv
│ └── MarianMT_models_short_list.csv
├── UI Localization
│ ├── gui_eng.csv / gui_pol.csv
│ └── language_display_names.csv
└── Language Mappings
└── lang_codes.csv
- Cache Files:
deepl_cache.txt,googletrans_cache.txt,gemini_cache.txt - API Logs:
Gemini_API_call_logs.txt,GEMINI_API_OCR_short_log.txt,GEMINI_API_TRA_short_log.txt - Debug:
translator_debug.log,debug_images/ - Models:
marian_models_cache/
developer-guide.md- Comprehensive development guideuser-manual.html/user-manual_pl.html- User manuals (EN/PL)installation.html/installation_pl.html- Installation guides (EN/PL)gallery.html/gallery_pl.html- Application galleries (EN/PL)troubleshooting.md- Problem resolution guideflags/,gallery/,screenshots/- Visual assets
README.md- Project overview and quick startCHANGELOG.md- Version historyLICENSE- GPL v3 licenseATTRIBUTION.md- Third-party attributionsCONTRIBUTORS.md- Project contributors
- 🔧 Modular Design - Each handler manages specific functionality
- ⚡ Performance - Background threads + unified caching
- 🌍 Localization - Multi-language UI and comprehensive language support
- 📊 Monitoring - Complete API usage tracking and cost management
- 🚀 Build Flexibility - Multiple compilation options (CPU/GPU)
- 🛠️ Maintainability - Clear separation of concerns and well-organized structure
📘 For detailed development information including:
- How to add new features
- Testing procedures
- Build instructions
- Code architecture details
- Contributing guidelines
See the comprehensive
docs/developer-guide.md