Metadata-Version: 2.4
Name: google-translate-unofficial
Version: 1.0.2
Summary: Unofficial Google Translate. No API key required.
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28.0
Requires-Dist: beautifulsoup4>=4.11.0
Provides-Extra: pdf
Requires-Dist: pypdf>=3.0.0; extra == "pdf"
Provides-Extra: docx
Requires-Dist: docx2txt>=0.8; extra == "docx"

# google-translate-unofficial (Python)
Unofficial Google Translate for Python - no API key required.





## Installation
```bash
pip3 install --upgrade google-translate-unofficial
```





## Usage
```bash
from google_translate_unofficial import translate, translate_batch, get_languages
```


### Translate a string
```bash
from google_translate_unofficial import translate

translate("Hello world", target="es")
# "Hola mundo"

translate("Bonjour", target="en", source="fr")
# "Hello"

translate("こんにちは", target="de")
# "Hallo"
```

The `source` parameter defaults to `"auto"`, letting Google detect the language automatically. Languages can be passed as full names or ISO codes interchangeably.

```bash
translate("Hello", target="spanish")
translate("Hello", target="es")
# both return "Hola"
```


### Translate a batch
```bash
from google_translate_unofficial import translate_batch

translate_batch(["cat", "dog", "house"], target="fr")
# ["chat", "chien", "maison"]
```


### Get supported languages
```bash
from google_translate_unofficial import get_languages

get_languages()
# ["afrikaans", "albanian", "amharic", ...]

get_languages(as_dict=True)
# {"afrikaans": "af", "albanian": "sq", "amharic": "am", ...}
```





## Notes
- The maximum safe input length is around 5000 characters per call.
- If you translate large batches in a tight loop you may hit rate limits. Add a small delay between calls if needed.
