An API for DeepL Translate, designed for the Discord Translation Bot, RITA.
- Auto language detection
- Source Language correction
From automatic language detection to English:
const translate = require('rita-deepl-translate-api');
translate('Ik spreek Engels', {to: 'en'}).then(res => {
console.log(res.text);
//=> I speak English
console.log(res.from.language.iso);
//=> nl
}).catch(err => {
console.error(err);
});
Type: string
The text to be translated
Type: object
Type: string
Default: auto
The text
language. Must be auto
or one of the codes/names (not case-sensitive) contained in languages.js
Type: string
Default: en
The language in which the text should be translated. Must be one of the codes/names (not case-sensitive) contained in languages.js.
Type: boolean
Default: false
If true
, the returned object will have a raw
property with the raw response (string
) from DeepL Translate.
Type: string
Default: "https://api-free.deepl.com"
DeepL uses different domains for free and non-free versions, you can change this to use the non-free version.
Type: string
Default: ""
DeepL needs an API Key in order to accept request - even in the free version. Please specify your DeepL API Key!
text
(string) – The translated text.from
(object)language
(object)didYouMean
(boolean) -true
if the API suggest a correction in the source languageiso
(string) - The code of the language that the API has recognized in thetext
raw
(string) - Ifoptions.raw
is true, the raw response from DeepL Translate servers. Otherwise,''
.