中文文档 README.md
A .NET console and tray application that provides instant translation with triple-space hotkey activation.

- Global hotkey detection (triple space)
- Automatic text translation with intelligent content detection
- Multiple translation engines (Youdao API, Google Gemini)
- System tray integration with visual status indicators
- Cross-platform support (Windows focused)
- Configurable settings with GUI interface
- .NET 8.0 or higher
- Windows (for global hotkey functionality)
SpaceTrans-Tray.exe
- Runs in system tray
- Triple-click tray icon for settings
- Right-click for menu options
SpaceTrans-CLI.exe
- Runs in console with text output
- Useful for debugging and logging
- type any text in any application
- triple-press Space to translate inputed content
- Translation automatically replaces inputed text
- triple-click tray icon to open settings
- Configure your preferred translation engine:
- Youdao: Requires App Key and App Secret
- Gemini: Requires Google API Key
- Set target language (en, zh, ja, ko, fr, de, es, ru)
- Test connection to verify configuration
Settings are stored in config.json:
{
"CurrentEngine": "Gemini",
"TargetLanguage": "en",
"YoudaoConfig": {
"AppKey": "your-app-key",
"AppSecret": "your-app-secret"
},
"GeminiConfig": {
"ApiKey": "your-api-key"
}
}
dotnet build
dotnet build -c Release
Self-Contained Executable
dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true
or
dotnet msbuild -t:ReleaseCli
dotnet msbuild -t:ReleaseTray
dotnet msbuild -t:ReleaseTray-net8
Place your custom icon.ico file in the application directory, or embed it as a resource in Resources/icon.ico.
- Visual status indicators: Icon changes during translation
- Silent operation: No popup notifications in tray mode
- Context menu: Quick access to all functions
- Settings GUI: Easy configuration management
- Automatic logging: All events logged to file
- Log file access: Right-click menu to open log file directly
SpaceTrans automatically logs all activities to help with debugging and monitoring:
- Tray Mode:
%LOCALAPPDATA%\SpaceTrans\app.log
- Console Mode:
%LOCALAPPDATA%\SpaceTrans\console.log
- Tray Mode: Info level and above
- Console Mode: Debug level and above (more verbose)
- Automatic rotation: Logs rotate when they exceed 10MB
- Timestamped entries: Each log entry includes precise timestamp
- Thread-safe: Safe for concurrent operations
- Translation tracking: Detailed translation request/response logging
[2024-12-08 14:30:25.123] [Info] [T1] Translation successful [Gemini]: 'Hello world...' -> '你好世界...'
- triple Space: Translate selected text
- Tray Menu: Toggle hotkey on/off, open log file, access settings
- double-click Tray Icon: Open settings directly
- High-quality translations
- Supports multiple language pairs
- Requires API credentials from Youdao
- AI-powered translations
- Natural language processing
- Requires Google AI API key
- Check if hotkey is enabled in tray menu
- Verify Windows permissions for global hooks
- Run as administrator if needed
- Check logs for hotkey installation errors
- Verify API credentials in settings
- Test connection using built-in test feature
- Check internet connectivity
- Review logs for detailed error information
- Delete
config.json to reset to defaults
- Ensure API keys are correctly entered
- Verify target language is supported
- Check logs for configuration loading errors
- Logs are stored in
%LOCALAPPDATA%\SpaceTrans\
- Log files automatically rotate at 10MB
- Console mode provides more detailed debug logging
- Check file permissions if logs aren't being written
- Current Version: 1.0.0
- Framework: .NET 8.0
- Platform: Windows 7.0+