Code Monkey home page Code Monkey logo

deepl-translate's Introduction

PyPI version Python Package codecov Downloads 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:

Abbreviation Language Writing in own language
BG Bulgarian Български
ZH Chinese 中文
CS Czech Česky
DA Danish Dansk
NL Dutch Nederlands
EN English English
ET Estonian Eesti
FI Finnish Suomi
FR French Français
DE German Deutsch
EL Greek Ελληνικά
HU Hungarian Magyar
IT Italian Italiano
JA Japanese 日本語
LV Latvian Latviešu
LT Lithuanian Lietuvių
PL Polish Polski
PT Portuguese Português
RO Romanian Română
RU Russian Русский
SK Slovak Slovenčina
SL Slovenian Slovenščina
ES Spanish Español
SV Swedish Svenska

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!'

deepl-translate's People

Contributors

1fexd avatar laserlicht avatar ptrstn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.