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.0-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.1.tar.gz (6.2 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.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydoc-translate-1.0.1.tar.gz
  • Upload date:
  • Size: 6.2 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.1.tar.gz
Algorithm Hash digest
SHA256 82691e8e47f629d489cfa0ddf5e927f49f22115991876d0931080b4fabf52c7e
MD5 cd8a75bbddc31704396f5465f19149a6
BLAKE2b-256 0d4de9df9ed23e086453e51bea932ee07ee9504333ac99e5a5aa350edf21092f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydoc_translate-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 af8327917660f3c9de45554c715564ffd51e0cc1fcc1a5c67a6cbfb5af40dffc
MD5 a935a88f98e89094b4a0397e7ccc69f4
BLAKE2b-256 9345d6e32c2ddb6eb423c91b1cc197f4e08b23dfe6ff355e77697c16b0dbb886

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