Skip to main content

deepl translate via pyppeteer

Project description

deepl-tr-pyppeteer

Codacy BadgeCode style: blackLicense: MITPyPI version

deepl translate via pyppeteer

Installation

pip install deepl-tr-pp

To update to the latest version:

pip install deepl-tr-pp -U
# poetry add deepl-tr-pp@latest  # if you use poetry

or clone the github repo, install and run from the source

git clone clone https://github.com/ffreemt/deepl-tr-pyppeteer
cd deepl-tr-pyppeteer
pip install poetry
poetry install --no-dev

poetry run python -m deepl_tr_pp  # equivalent to executing `deepl-tr-pp` below

Usage

Languages supported: ["en", "de", "zh", "fr", "es", "pt", "it", "nl", "pl", "ru", "ja"] (currently supported by the website)

Input file formats currently supported: txt and docx, files with other suffix (e.g., .csv, .tsv) will simply treated as text.

To interrupt anytime: Ctrl-c. The first few versions may not run too smoothly. If it hangs, press control and c at the same time to exit.

deepl-tr-pp -p file.txt  # en to zh, default en to zh, dualtext output, docx format
deepl-tr-pp -p file.txt -f de   # de to zh
deepl-tr-pp -p file.txt -f de -t en  # de to en

deepl-tr-pp   # browse for a file, en to zh

deepl-tr-pp --copyfrom   # text from the clipboard, en to zh

deepl-tr-pp -p file.txt --nodualtext  # en to zh, default en to zh, just translate text

deepl-tr-pp -p file.txt --nooutput-docx  # default en to zh, dualtext, text format

By default, the text version of the output is copied to the clipboard, turn this off by --nocopyto

deepl-tr-pp -p file.txt --nocopyto

Finer Control Using .env and Environ Variables

To show the browser in action or set debug or proxy, create an .env file and set the corresponding environ variables (these can also be set from the command line, e.g., set DEEPLTR_HEADFUL=true (in Windows) or export DEEPLTR_HEADFUL=true (in Linux) ):

# .env
DEEPLTR_HEADFUL=true
DEEPLTR_DEBUG=true

# DEEPLTR_HEADFUL=True
# DEEPLTR_HEADFUL=tRue  # also works
# DEEPLTR_HEADFUL=False
# DEEPLTR_HEADFUL=fAlse
# DEEPLTR_HEADFUL=1
# DEEPLTR_HEADFUL='1'
# must use capitals
# DEEPLTR_PROXY=SOCKS5://127.0.0.1:1080

Help

deepl-tr-pp  --helpshort
  --[no]copyfrom: copy from clipboard, default false, will attempt to browser
    for a filepath if copyfrom is set false)
    (default: 'false')
  --[no]copyto: copy the result to clipboard
    (default: 'true')
  --[no]debug: print debug messages.
    (default: 'false')
  -d,--[no]dualtext: dualtext or no dualtext output
    (default: 'true')
  -p,--filepath: source text filepath (relative or absolute), if not provided,
    clipboard content will be used as source text.
    (default: '')
  -f,--from-lang: source language, default english)
    (default: 'en')
  -o,--[no]output-docx: output docx or text
    (default: 'true')
  -t,--to-lang: target language, default chinese
    (default: 'zh')
  --[no]version: print version and exit
    (default: 'false')

or

deepl-tr-pp --helpfull

For Developers

  • Install poetry the way you like it.

  • git clone the repo https://github.com/ffreemt/deepl-tr-pyppeteer, cd deepl-tr-pyppeteer

    • Or fork first and git pull your own repo.
  • poetry install

  • Activate the virtual environment, e.g., .venv\Scripts\activate (In Windows) or source .venv/bin/activate (in Linux) provided you set poetry config --local virtualenvs.in-project true

    • python -m deepl_tr_pp
  • Code and optionally submit PR

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

deepl-tr-pp-0.1.3.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

deepl_tr_pp-0.1.3-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file deepl-tr-pp-0.1.3.tar.gz.

File metadata

  • Download URL: deepl-tr-pp-0.1.3.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.6.7 Windows/10

File hashes

Hashes for deepl-tr-pp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c00d0b9952ff152113fe08768d67b64d74149c9aab014fe0e74b8f943a24686f
MD5 f8490d318f22b255a9ed2cb2e6f9432c
BLAKE2b-256 84d0fdaeab6d85ed54a0a0b65f7af87809938a9776a3805827fcd3e188a8941d

See more details on using hashes here.

File details

Details for the file deepl_tr_pp-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: deepl_tr_pp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.6.7 Windows/10

File hashes

Hashes for deepl_tr_pp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d4c8d7d2a79990100fe1335a0bbdeab816f3ba67c9510da9beb454c681e67538
MD5 3d2975cba273b4ba7e7f0673ad5a76c8
BLAKE2b-256 0fcc982bee8739dcf8eececc4c205696c27720db4741eae7534bffbdb23815e4

See more details on using hashes here.

Supported by

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