0.1.2 • Published 5 months ago

deeplx v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

DeepL Translate

GitHub Actions Codecov Codacy Grade type-coverage npm GitHub Release

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

An unofficial Node package to translate text using DeepL.

Online Service

https://deeplx.vercel.app/translate

Installation

# npm
npm i deeplx

# pnpm
pnpm add deeplx

# yarn
yarn add deeplx

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

deeplx --help
Usage: deeplx [options]

An unofficial Node package to translate text using [DeepL](https://www.deeplx.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):

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

Example 2

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

deeplx -tl PT -f test.txt

Example 3

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

deeplx -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:

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

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

Example 2

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

import { translate } from 'deeplx'

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