googletrans-python
Google Translate in one line of Python. No API key. No dependencies. Just works.
Why This Exists
Every other Google Translate library is either broken, bloated, or requires an API key.
This one doesn't.
gt.translate("Hello, World!", "ko")
# - 'annyeonghaseyo, weoldeu!'
That's it. No setup, no tokens, no httpx, no requests. Just the standard library.
Installation
Usage
# English - Korean
gt.translate("Good morning", "ko")
# - 'joheun acim'
# English - Japanese
gt.translate("Good morning", "ja")
# - 'ohayougozaimasu'
# English - French
gt.translate("Good morning", "fr")
# - 'Bonjour'
# Auto-detect source language
gt.translate("Bonjour le monde", "en")
# - 'Hello world'
# Specify source language explicitly
gt.translate("konnichiha", "en", from_language="ja")
# - 'Hello'
API
to_translate: str, # Text to translate
to_language: str, # Target language code
from_language: str = "auto" # Source language (auto-detected by default)
) -> str
Supported Languages
All Google Translate language codes are supported. Common ones:
| Code | Language | Code | Language | Code | Language |
|---|---|---|---|---|---|
en |
English | ko |
Korean | ja |
Japanese |
zh-CN |
Chinese (Simplified) | zh-TW |
Chinese (Traditional) | fr |
French |
de |
German | es |
Spanish | pt |
Portuguese |
ru |
Russian | ar |
Arabic | hi |
Hindi |
vi |
Vietnamese | th |
Thai | id |
Indonesian |
How It Works
No REST API. No OAuth. No client library.
It hits Google Translate's mobile web endpoint (translate.google.com/m) and parses the result -- the same page your browser renders when you visit Google Translate on a phone.
urllib.request - translate.google.com/m - regex parse - translated text
The entire implementation is one function, ~15 lines of code, with zero external dependencies.
Comparison
| Library | API Key | Dependencies | Working (2025) |
|---|---|---|---|
| googletrans-python | Not needed | 0 | |
| googletrans 4.0.0-rc1 | httpx | ||
| google-cloud-translate | Required | grpcio, google-auth, ... | (paid) |
| deep-translator | requests, beautifulsoup4 |
Limitations
Be aware of these tradeoffs -- this is a scraping-based approach, not an official API:
- Rate limiting -- Google may throttle or block IPs making too many requests
- No batch translation -- One call per string
- No detection API -- Can't return detected language metadata (auto-detect still works for translation)
- Unofficial -- Google can change the page structure at any time
For production workloads with high volume, consider the official Cloud Translation API.
License
MIT
If this saved you from setting up a GCP project just to translate one string, consider leaving a