• Home
  • >
  • Software Development
  • >
  • Getting Started with the DeepL Language Translation API in Python  – InApps Technology 2022

Getting Started with the DeepL Language Translation API in Python  – InApps Technology is an article under the topic Software Development Many of you are most interested in today !! Today, let’s InApps.net learn Getting Started with the DeepL Language Translation API in Python  – InApps Technology in today’s post !

Read more about Getting Started with the DeepL Language Translation API in Python  – InApps Technology at Wikipedia

You can find content about Getting Started with the DeepL Language Translation API in Python  – InApps Technology from the Wikipedia website

Daniel Jones

Daniel Jones is a developer advocate at DeepL focusing on helping fellow developers create great things using the DeepL API. He has a background in Mechatronics Engineering, and object perception using Lidar for autonomous driving. He relocated from New Zealand to Hamburg, Germany in 2013.

There’s an API for almost everything these days, and language translation is no exception. In this tutorial, we’ll show you how to get started with the DeepL language translation API using our official open source Python client library.

Before we do that, we’ll answer a couple of questions: what is DeepL, and what are the use cases for a language translation API?

DeepL is our machine translation company with a mission to eliminate language barriers worldwide using artificial intelligence. We might not be the only language translation API out there, but we’re proud of the fact that we achieve some of the best translation quality worldwide according to blind tests and that we take data privacy really seriously. If you’d like to see what we’re all about, our web translator is a good place to get started.

The rest of this piece will focus on our API, which supports 24 source and target languages and makes it possible for developers to build translation directly into their products.

Common use cases for an API like DeepL’s include but are not limited to:

  • Website translation, especially for e-commerce companies or publishers with a large catalog of content that changes frequently
  • Cross-language communication via chat apps or customer service platforms, where content is user generated and needs to be translated on the fly
  • Building a custom document translation tool for use within a company (in addition to text, the DeepL API lets you translate Microsoft Word, PowerPoint, HTML, and plain text documents)

Let’s get started.

First Steps

Mike Winters

Mike Winters has spent the last seven years in product and community management roles for the companies behind products such as Apache Flink, Camunda, Garden.io, and now DeepL. He spends lots of time thinking and writing about the impact of emerging technologies on organizations of all shapes and sizes. An Ohio native, he’s currently based in Berlin, Germany.

This tutorial was designed so that you can follow along for free — you’ll just need to create a DeepL API account first so that you can get access to an authentication key (note: at this time, it’s possible for users in these countries to create DeepL API Free and Pro accounts).

And we chose to stick to the basics in this tutorial, with the goal being to introduce what’s possible with our language translation API and hopefully spark an idea or two about how you might apply it to your use cases.

We’ll include the code snippets you need for every step of the tutorial, but there are a couple pages you might want to have open in separate tabs while you’re working:

  • The GitHub repo for the Python client library (the README includes documentation for the Python library along with many of the examples we’ll walk through below)
  • The DeepL API docs, which covers the REST interface that the Python library is built around and would be helpful if you’d like to experiment in a language besides Python
Read More:   2021’s Biggest Stories – InApps Technology 2022

First step: you’ll need to install the library from PyPI using pip.

From this point forward, we’ll be writing Python code. Create a new file named deepl_tutorial.py (and be sure that neither your file nor the parent directory is named deepl).

The first thing we’ll need our script to do is create a translator object. This is where you’ll need the DeepL authentication key, which you can find in your account.

Translating Text

It’s only appropriate that we’d kick things off with a “Hello, world!” example, so the first thing we’ll do is translate “Hello, world!” from English to German.

You’ll notice that we use the target_lang parameter to set our target language. DeepL can automatically detect the source language, so we don’t specify it below. But you’re also able to set the source language explicitly using the source_lang parameter.

It’s also possible to translate multiple texts into the same target language at once. Here, we’ll translate Japanese and Spanish into US English (once again relying on DeepL’s language detection capabilities to identify the source languages).

We’ll print the results, and we’ll also verify the detected source languages.

Supported Source and Target Languages

You’ve seen so far that DeepL can translate German, US English, Japanese, and Spanish, but in the introduction, we promised more than 20 source and target languages.

You can find the full list of supported source and target languages plus the two-letter language codes in the documentation.

It’s also possible to use the API to get lists of supported source and target languages.

Monitoring Usage

You might occasionally want to check in on how many characters you’ve translated — our API Free plan allows for 500,000 characters per month, while our API Pro plan offers volume-based pricing and no character limits.

Document Translation (and Formality, too)

We mentioned that the DeepL API also lets you translate Microsoft Word, PowerPoint, HTML, and plain text documents. To keep the tutorial simple, we’ll use an example with a text file.

Here’s a hypothetical use case. As non-native German-speakers who live in Germany, we might need to send emails to our landlords in German. Just to be sure our translations are precise, we’d like to check them with DeepL.

Read More:   Twilio’s Quest to Offer All the APIs for Modern Day Messaging – InApps Technology 2022

(As an aside: this is a small-scale example for the sake of the tutorial. However, this feature can be helpful for larger tasks, like translating a website’s worth of HTML files or a large collection of Word documents.)

I’m going to translate a text file with the following content:

Dear Sir or Madam, 

I would like to inform you that we still do not have hot water in our apartment, now for five days in a row. Seeing as it's the middle of January, could you please send someone to repair the hot water heater? 

Kind regards, 

Your Favorite Tenant 

The text file I’m translating is called email-to-landlord-en.txt, and I’d like the translated file to be called email-to-landlord-de.txt.

Two tips we’ll share before we translate a document:

  • Translating PowerPoint or Microsoft Word documents with the API count as a minimum of 50,000 characters toward your usage, even when there are fewer than 50,000 characters in the document. This is important to keep in mind if you’re watching your usage closely.
  • Be sure the file that you’re translating is in your working directory before running the following code snippet.

Et voilà! My translated file email-to-landlord-de.txt is now available in my working directory with the following translated text:

Sehr geehrte Damen und Herren, 

Ich möchte Sie darüber informieren, dass wir immer noch kein heißes Wasser in unserer Wohnung haben, nun schon fünf Tage in Folge. Da es Mitte Januar ist, könnten Sie bitte jemanden schicken, um den Warmwasserboiler zu reparieren? 

Mit freundlichen Grüßen, 

Ihr Lieblingsmieter 

You might’ve noticed that when translating the text file, I introduced a new parameter called formality. Let’s consult the docs to see what it refers to:

Formality sets whether the translated text should lean towards formal or informal language. This feature currently only works for target languages “DE” (German), “FR” (French), “IT” (Italian), “ES” (Spanish), “NL” (Dutch), “PL” (Polish), “PT-PT” / “PT-BR” (Portuguese), and “RU” (Russian)

You can set “more” for more formal language and “less” for less formal language.

When reaching out to my landlord to request a repair, I know I want to use “more formal” German, and luckily, DeepL makes that easy. But if I were translating an email to send to a close friend, I could easily choose “less formal” German instead.

Wrapping up and Next Steps

Thanks for joining us to get hands-on with the DeepL API!

We hope you found the tutorial to be helpful, and if you have any feedback about the Python client library, we encourage you to create an issue in the GitHub repo. It’s an open source project, and we’d love to hear your ideas.

And the API documentation is the best place to learn about supported languages and file formats, plus more advanced use cases such as handling XML.

To stay updated on what we’re working on, we recommend checking out our blog.

That’s all for now. Happy translating!

InApps Technology is a wholly owned subsidiary of Insight Partners, an investor in the following companies mentioned in this article: Camunda.

Source: InApps.net

List of keywords users find our article on Google:

deepl
deepl translator
deepl translate
microsoft translator
deelp
deppl
deepl english to german
deep l
camunda tutorial
deepl english to spanish
deepl com
camunda docs
deepl pro
camunda rest api
camunda pricing
deepl app
camunda basics
whatsapp api python
camunda documentation
depl
deeple
flink recruitment
camunda tenant
camunda rest api docs
deepl english german
deep translator
camunda upgrade
deepk
deepl com translator
camunda docs rest api
camunda getting started
camunda docker
camunda document
install camunda
camunda apis
translate from german into english
camunda rest api documentation
influxdb tutorial python
facebook api documentation
camunda enterprise
camunda use cases
twitter api python
// in python
german to english deepl
english to spanish deepl
docs camunda
deep l translator
translate deepl
deepl translate app
flink api
mit freundlichen grüßen translate
deepl translator app
deepld
deepl translation
eepl
camunda get started
api camunda
apache camunda
deepll
camunda api
dipple
camunda install
hello translator
translate german into english
rest api camunda
camunda users
hot in spanish translation
translation english german
type in spanish translate to english
translate water to japanese
translate delivery to spanish
deepl review
status time limit exceeded
flink table api
free translation apis
dear sir or madam in italian
outsourced website translation solution
camunda
whatsapp python api
delivery translate spanish
whatsapp business api python
apache flink
spanish translator german
deepl translate english to spanish
deepl spanish english
deepl polish to english
french polish fintech translator
deepl english
dipl translate
deepl fr
frame.io wikipedia
how to translate a wikipedia page from german to english
txt translations
wikipedia deepl
www deepl com
deepl pro gratis
deeol
deepl french to english
kind regards translate
camunda api docs
deepl.com/translator
deepl price
deepl traslate
noch translation
deepi
offshore it translator
вуузду
camunda examples
deepl;
translate target to spanish
camunda message
depl translator
tdeepl
deepl’com
deepl*
mit freundlichen grüßen translate to english
deepl.pl
deep^l
love limit exceeded
translator deepl
txt twitter translation
camunda send task
deep pl
wohnung translate
вуузд
ddepl
deepl de
deeppl
deep l translate
deep-l
deep/l
offshore translation
twitter deepl
dpl translator
flink examples
niche translate
regards in german translation
deepl translater
python influxdb client example
common projects herren
deepl transaltor
deepl.com
translator pl nl
derpl
immer translation
camunda api rest
deeepl
github translate
what is your name in french translation
camunda business key
document traduction
machine translation github
python write influxdb
translate enjoy to spanish
apache flink monitoring
deep[l
hot in portuguese translation
sehr geehrte damen und herren in english
camunda default login
flink monitoring
hot italian translation
setmore api
autonomous translation
hot in italian translation
linkedin api python
translate ihr
translate too to spanish
flink python
hamburg nach ho chi minh
python time limit exceeded
translate happy spanish
flink rest api
helloworld travel limited
char translate
minimum viable product template ppt
python influxdb tutorial
python linkedin api
translate from english to germany
achieve translate spanish
api readme example
wawa berlin
translate french into german
happy translate
i want to see you translate in spanish
cómo estás in english
debugging translate
deepl übersetzer app
machine traduction
cómo estás” in english
deepl,com
hello how you doing in spanish
hello translate spanish
influx python
python jobs hamburg
setmore app
authentication translate
dear translate
flink example
how are you doing in french language
python middle developer
camunda products
germany to english translate
translate thank you into spanish
wir translation
camunda enterprise features
spanish word for nun
translate linkedin profile to english
french saas translator
import documents translation services
translate fr es
translate great to spanish
deepl translator review
hello translation spanish
introduction to hospitality and tourism industry ppt
send message whatsapp with python
translate english into german
translate polish into english
how you doing today in spanish
review deepl
sehr geehrte damen und herren english
translate hi into spanish
translator microsoft
how to check if a char is a letter python
kind regards in german
let it be translate
microsoft translator api key
microsoft translator pricing
pegas’print
bitte in german means
check in spanish translation
kind regards in japanese
german translator jobs
i m translator
kick ich pro
py-translate
what were you doing in spanish
www deepl
api to translate language
convert german to english
heard translate to spanish
hello how are you in spanish
influxdb limit
landlord mobile game
snippet in spanish
translate happy
translator dutch german
what are you doing now in spanish
custom translator
how are you in german informal
in python
translate english to vietnam
translation of shapes
Rate this post
Admin
Admin
Content writer

Let’s create the next big thing together!

Coming together is a beginning. Keeping together is progress. Working together is success.

Let’s talk

Let’s Create the Next Big Thing Together!

You can reach us anytime via sales@inapps.net

    You need to enter your email to download

      Success. Downloading...