Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gui117/translate
A command-line translation tool written in Rust that supports automatic language detection and multi-language translation. Based on Google Translate API.
https://github.com/gui117/translate
clap-rs rust translate
Last synced: 14 days ago
JSON representation
A command-line translation tool written in Rust that supports automatic language detection and multi-language translation. Based on Google Translate API.
- Host: GitHub
- URL: https://github.com/gui117/translate
- Owner: gui117
- License: mit
- Created: 2025-01-10T02:01:10.000Z (27 days ago)
- Default Branch: master
- Last Pushed: 2025-01-10T02:19:19.000Z (27 days ago)
- Last Synced: 2025-01-10T03:18:46.209Z (27 days ago)
- Topics: clap-rs, rust, translate
- Language: Rust
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Translate CLI
A command-line translation tool written in Rust that supports automatic language detection and multi-language translation. Based on Google Translate API.
[中文文档](./README_zh.md)
## Features
- No API key required
- Automatic language detection
- Support for 100+ languages## Installation
### From Source
```bash
git clone https://github.com/yourusername/translate.git
cd translate
cargo install --path .
```## Examples
```bash
# English to Chinese
translate "Hello, World!"
> 你好,世界!# Chinese to English
translate "你好,世界!"
> Hello, World!# Japanese to Chinese
translate --source ja --target zh-CN "こんにちは世界"
> 你好世界# Auto-detect to German
translate --target de "Hello World"
> Hallo Welt
```### Command-line Options
```
Options:
-s, --source Source language (default: auto)
-t, --target Target language (default: auto)
-l, --list Show supported languages
-h, --help Show help information
-V, --version Show version information
```### Common Language Codes
- `auto` - Auto detect
- `en` - English
- `zh-CN` - Chinese Simplified
- `ja` - Japanese
- `ko` - Korean
- `fr` - French
- `de` - GermanUse `translate --list` to see the complete language list.
## Notes
1. This tool uses an unofficial Google Translate API and may have stability issues
2. To avoid IP restrictions, please control request frequency
3. Some languages may require specific character encoding support
4. Auto-detection may not always be 100% accurate## Contributing
Issues and Pull Requests are welcome!
## Credits
- Google Translate API
- [clap-rs](https://github.com/clap-rs/clap) - Command line argument parser
- [reqwest](https://github.com/seanmonstar/reqwest) - HTTP Client
- [alfred-translate-workflow](https://github.com/meshchaninov/alfred-translate-workflow)## License
MIT