Skip to content

mutiullah15/pytranslator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Python Translator

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.

Features

  • Translates text from one language to another.
  • Asynchronous execution using Python's asyncio.
  • Automatically detects the source language if not specified.

Requirements

The project requires the following Python packages, which are listed in the requirements.txt file:

  • anyio==4.9.0
  • certifi==2025.1.31
  • googletrans==4.0.2
  • h11==0.14.0
  • h2==4.2.0
  • hpack==4.1.0
  • httpcore==1.0.7
  • httpx==0.28.1
  • hyperframe==6.1.0
  • idna==3.10
  • sniffio==1.3.1

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/your-repo-name.git
    cd your-repo-name
    
  2. Create a virtual environment (optional but recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install the required dependencies:

    pip install -r requirements.txt

Usage

  1. Run the script:

    python Google_Trans.py
  2. 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

Example Output

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

Notes

  • The googletrans library 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.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • The googletrans library: PyPI - googletrans
  • Python's asyncio module for asynchronous programming.

About

This is a simple (fully commented for newbies 👶) 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.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages