A command-line translation tool.
- 🖥️ Cross-platform — runs on Linux (glibc/musl), macOS (Apple Silicon), and Windows (x86_64)
- 📋 Clipboard support — no text argument needed, translates clipboard content automatically
- 🌐 9 languages — Chinese, English, Japanese, French, Spanish, Russian, Latin, Korean, Traditional Chinese
- ⚡ Lightweight & fast — single static binary, no runtime dependencies
curl -fsSL https://raw.githubusercontent.com/mars-base/fy/main/install.sh | bashOr download the script and run it manually:
curl -fsSL https://raw.githubusercontent.com/mars-base/fy/main/install.sh -o install.sh
chmod +x install.sh
./install.sh --help
./install.sh # install latest version
./install.sh --version v0.1.1 # install specific versionSupported: macOS Apple Silicon (arm64), Linux x86_64 (musl by default), and Windows x86_64.
Windows
# Install latest version
irm https://raw.githubusercontent.com/mars-base/fy/main/install-windows.ps1 | iex
# Or download and run with parameters
irm https://raw.githubusercontent.com/mars-base/fy/main/install-windows.ps1 -OutFile install-windows.ps1
.\install-windows.ps1 -Version "0.1.3"Linux
make build && sudo make install # glibc (dynamically linked)
make musl && sudo make install-musl # musl (statically linked, portable)macOS
make darwin-arm64 && sudo cp build/fy-darwin-arm64 /usr/local/bin/fy # Apple Silicon (arm64)
# make darwin-intel # Intel Mac (local macOS host only)Download from GitHub Releases. Release builds include:
- Linux: glibc + musl (static)
- macOS: arm64 (Apple Silicon)
- Windows: x86_64-pc-windows-msvc
fy <target_language> [text]
If no text argument is given, fy reads from the system clipboard.
# Translate to English
fy en "你好世界" # Hello World
# Translate to Chinese
fy zh "Hello, how are you today?" # 你好,今天怎么样?
# Translate to Japanese
fy ja "你好" # こんにちは
# Translate clipboard content to Chinese
fy zh
# Show help
fy -h| Code | Language |
|---|---|
| zh | Chinese |
| en | English |
| ja | Japanese |
| fr | French |
| es | Spanish |
| ru | Russian |
| la | Latin |
| ko | Korean |
| tw | Traditional Chinese |
make build # Build release binary (glibc)
make musl # Build static binary (musl)
make darwin-intel # Build macOS x86_64 (macOS host only)
make darwin-arm64 # Build macOS arm64 (macOS host only)
make test # Run unit tests
make check # Run integration tests
make clean # Clean build artifacts- Parse CLI args: target language code + optional text
- If no text arg, read from system clipboard
- Validate input — rejects control chars and binary content
- Translate via Google Translate API
- Print translated result
src/main.rs— Entry point, CLI parsing, translation logic, clipboard handlingsrc/vars.rs— Global constants: supported languages, API URL, app metadatasrc/clipboard.rs— System clipboard read viaarboardsrc/utils/— Utility library:url.rs— HTTP client wrapper (async viareqwest)json.rs— JSON parsing helperstools.rs— Process exit, random strings, UUID generation
src/tests/— Test modules
MIT