This is a simple Python-based translator application that uses the googletrans library to translate text asynchronously. The project demonstrates the use of asynchronous programming with asyncio and the googletrans library for language translation.
- Translates text from one language to another.
- Asynchronous execution using Python's
asyncio. - Automatically detects the source language if not specified.
The project requires the following Python packages, which are listed in the requirements.txt file:
anyio==4.9.0certifi==2025.1.31googletrans==4.0.2h11==0.14.0h2==4.2.0hpack==4.1.0httpcore==1.0.7httpx==0.28.1hyperframe==6.1.0idna==3.10sniffio==1.3.1
-
Clone the repository:
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name -
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the script:
python Google_Trans.py
-
The script will translate the text
"Man gets what he strives for!"into French and display the following:- Original text
- Translated text
- Detected source language
Translated(src=en, dest=fr, text=L'homme obtient ce pour quoi il s'efforce !, pronunciation=L'homme obtient ce pour quoi il s'efforce !, extra_data="{'translat...")
Original: Man gets what he strives for!
Translated: L'homme obtient ce pour quoi il s'efforce !
Detected Language: en
- The
googletranslibrary may occasionally face issues due to changes in the Google Translate API. If you encounter any problems, consider checking the library's GitHub repository for updates or alternatives.
This project is licensed under the MIT License. See the LICENSE file for details.
- The
googletranslibrary: PyPI - googletrans - Python's
asynciomodule for asynchronous programming.