dt
deepl-translate
pypi i deepl-translate
dt

deepl-translate

An unofficial python package to translate text using deepl.com

by Peter Stein

1.2.0 (see all)License:MIT
pypi i deepl-translate
Readme

PyPI version Python Package codecov Code style: black

DeepL Translate

An unofficial python package to translate text using DeepL.

Installation

pip install deepl-translate

Usage

Supported languages

Currently the following languages are supported:

AbbreviationLanguageWriting in own language
BGBulgarianБългарски
ZHChinese中文
CSCzechČesky
DADanishDansk
NLDutchNederlands
ENEnglishEnglish
ETEstonianEesti
FIFinnishSuomi
FRFrenchFrançais
DEGermanDeutsch
ELGreekΕλληνικά
HUHungarianMagyar
ITItalianItaliano
JAJapanese日本語
LVLatvianLatviešu
LTLithuanianLietuvių
PLPolishPolski
PTPortuguesePortuguês
RORomanianRomână
RURussianРусский
SKSlovakSlovenčina
SLSlovenianSlovenščina
ESSpanishEspañol
SVSwedishSvenska

You can either input the abbreviation or the language written in english.

Command line tool

Help

deepl --help
usage: deepl [-h] [--version] [--formal | --informal] [-t TEXT | -f FILE] source_language target_language

Python client to translate texts using deepl.com

positional arguments:
  source_language       Source language of your text
  target_language       Target language of your desired text

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --formal              Use formal tone in translation
  --informal            Use informal tone in translation
  -t TEXT, --text TEXT  Text to be translated
  -f FILE, --file FILE  File to be translated

Example 1

This will translate a Spanish (ES) text into Russian (RU):

deepl spanish russian -t "¡Buenos días!"

Example 2

This will translate the file (test.txt) text from Italian (IT) into Portuguese (PT):

deepl IT PT --file test.txt

Example 3

This will translate a Spanish (ES) text into Russian (RU) in formal tone:

deepl ES RU --text "¿Cómo te llamas?" --formal

Note: informal would be "Как тебя зовут?"

Example 4

This will translate a Japanese (JP) text into German (DE) in informal tone:

deepl JP DE --text "お元気ですか?" --informal
Wie geht es dir?

Note: formal would be "Wie geht es Ihnen?"

Python library

Example 1

This will translate a Chinese (ZH) text into Dutch (NL):

import deepl
deepl.translate(source_language="ZH", target_language="NL", text="你好")
'Hallo'

Example 2

This will translate a danish text into german in informal tone:

import deepl
deepl.translate(source_language="danish", target_language="german", text="Ring til mig!", formality_tone="informal")
'Ruf mich an!'

GitHub Stars

65

LAST COMMIT

8mos ago

MAINTAINERS

1

CONTRIBUTORS

3

OPEN ISSUES

3

OPEN PRs

0
VersionTagPublished
1.2.0
8mos ago
No alternatives found
No tutorials found
Add a tutorial