Skip to main content

Translate Python comments and docstrings into any language.

Project description

PyDoc Translate

Automatically translate comments and docstrings in a Python project, without touching regular strings.


Features

  • Docstrings & Comments: Translate """ ... """, ''' ... ''', and # ... comments into the language of your choice.
  • Graphical User Interface (GUI): Easily switch to GUI mode using the Pydoc-Translate command.
  • Command-Line Interface (CLI): Automate translation using the Pydoc-Translate-CLI command, perfect for integration into other scripts.
  • Output Folder: Translated files are stored in an output folder, created automatically.
  • Cyberpunk Style: Minimalistic, dark-themed interface for an immersive experience.

Installation

  1. Clone this repository:
    git clone https://github.com/Taks-69/PyDoc-Translate
    
  2. Navigate to the project directory:
    cd PyDoc-Translate
    
  3. Install the module (build the distributions, then install them):
    python setup.py sdist bdist_wheel
    pip install dist\pydoc_translate-1.0.2-py3-none-any.whl
    

Usage (GUI)

  1. Navigate to the directory where you want the output folder to be created.
  2. Launch the GUI:
    Pydoc-Translate
    
  3. Select a .py file or a folder containing .py files.
  4. Enter the target language (e.g., en, fr, es, etc.).
  5. Click "Start Translation".
  6. Translated files will appear in the output folder at the same location where the command was run.

Usage (CLI)

  1. Run the following command:

    Pydoc-Translate-CLI --path="my_file.py" --lang=es --output="output_es"
    
    • --path: Path to a .py file or a folder containing .py files.
    • --lang: Target language (default: en).
    • --output: Name of the output folder (default: output).
  2. Translated files will be saved in the specified folder (output_es in the example).


Example Input File

""" Hello everyone, test 01 Display hello """
print("hello")

""" Another docstring """
# Hello everyone, test 02 Display hello

" Simple string, not translated "

Output Example (e.g., in fr)

""" Bonjour tout le monde, test 01 Afficher bonjour """
print("hello")

""" Un autre docstring """
# Bonjour tout le monde, test 02 Afficher bonjour

" Simple string, not translated "

Disclaimer

For educational use only. Any misuse or inappropriate use of this program is solely the responsibility of the user.


Technologies Used

  • Python 3
  • Googletrans (Unofficial API)
  • Tkinter for the GUI (included in most Python distributions)
  • argparse for the CLI

License

This project is licensed under the GNU General Public License v3.0.


⭐ Feel free to leave a star if you find this project useful!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydoc-translate-1.0.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydoc_translate-1.0.2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file pydoc-translate-1.0.2.tar.gz.

File metadata

  • Download URL: pydoc-translate-1.0.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.13

File hashes

Hashes for pydoc-translate-1.0.2.tar.gz
Algorithm Hash digest
SHA256 98dafd833be101b3f0d43fb52775cd86ba30daf66bf42aa2cc0620a42a15b517
MD5 9aaa7834538f9329713cf6f74c0cff69
BLAKE2b-256 05b3eea6da7966da08d675c63f831e8588e36e8cbfb4e09fe2e7a7cb3f875bab

See more details on using hashes here.

File details

Details for the file pydoc_translate-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pydoc_translate-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 32b50ae616843a63fcf593c42567856d72cc85fa163abc8030fbbe0aac037a5c
MD5 1dd91ecea350fdcbf1b3006154d4fab1
BLAKE2b-256 6c8254678f31a5bc879a2db64bc13c2dae7418d50b3be24460df4db59b74cbc6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page