1.1.4 • Published 3 years ago

deepl-client v1.1.4

Weekly downloads
290
License
MIT
Repository
github
Last release
3 years ago

Tests Linter Build

DeepL Client

See the official documentation for the available parameters.

You can make a simple request using the following code.

const params: TranslationParameters = {
  auth_key: your.authentication.key,
  text: 'This is a sentence.',
  target_lang: Language.French,
};

await translate(params);

Which will return a TranslationResponse, containing an array with the translation, and the detected source language.

{
  "translations": [
    {
      "detected_source_language": "EN",
      "text": "C'est une phrase."
    }
  ]
}

Translate Multiple

To translate an array of text, you can use the translateMultiple function.

const params: TranslationMultipleParameters = {
  auth_key: your.authentication.key,
  target_lang: Language.French,
};

const text = ['This is a sentence.', 'This is another sentence.'].

await translateMultiple(params, text);

Which will return the same TranslationResponse, except with more entries.

{
  "translations": [
    {
      "detected_source_language": "EN",
      "text": "C'est une phrase."
    },
    {
      "detected_source_language": "EN",
      "text": "C'est une autre phrase."
    }
  ]
}

Usage

To see the usage statistics linked to your authorization key, you can use the usage function.

const params: UsageParameters = {
  auth_key: your.authentication.key
};

await usage(params);

Which will return a UsageResponse, containing the used character count and the set characterl limit.

{
  "character_count":398,
  "character_limit":5000000
}

Missing something? Don't hesitate to open an issue or pull request!

Contributing

Install the dependencies using npm ci.\ Run the linter with npm run lint.\ Copy the env.example file and add a valid API key.\ Run the tests with npm t.

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.22-beta.0

3 years ago

1.0.22-beta.1

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13-beta.2

3 years ago

1.0.13-beta.0

3 years ago

1.0.13-beta.1

3 years ago

1.0.13

3 years ago

1.0.12-beta.2

3 years ago

1.0.12-beta.1

3 years ago

1.0.12-beta.0

3 years ago

1.0.11-beta.1

3 years ago

1.0.11-beta.2

3 years ago

1.0.11-beta.0

3 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago