DeepL Translate

GitHub Actions Codecov Codacy Grade type-coverage npm GitHub Release

David Peer David David Dev

Conventional Commits Renovate enabled JavaScript Style Guide Code Style: Prettier changesets

An unofficial Node package to translate text using DeepL.

Installation

# npm
npm i deepl-translate

# pnpm
pnpm add deepl-translate

# yarn
yarn add 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 [options]

An unofficial Node package to translate text using [DeepL](https://www.deepl.com).

Options:
  -V, --version                  output the version number
  -sl, --source-language <text>  Source language of your text
  -tl, --target-language <text>  Target language of your desired text
  --formal                       Use formal or informal tone in translation (default: false)
  -t, --text                     Text to be translated
  -f, --file                     File to be translated
  -h, --help                     display help for command

Example 1

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

deepl -tl russian -t "¡Buenos días!"
Доброе утро!

Example 2

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

deepl -tl PT -f test.txt

Example 3

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

deepl -tl 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 -tl DE --text "お元気ですか?" --formal false
Wie geht es dir?

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

Node library

Example 1

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

import { translate } from 'deepl-translate'

translate('你好', 'NL', 'ZH')
'Hallo'

Example 2

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

import { translate } from 'deepl-translate'

translate('Ring til mig!', 'german', 'danish', undefined, undefined, false)
'Ruf mich an!'