0.0.7 • Published 2 years ago

deepl-lightweight-client v0.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

deepl-lightweight-client

deepl-lightweight-client is unofficial DeepL API Client. It is useful for translating Language easily.

Official documentation: https://www.deepl.com/api.html

Installation

$ yarn add deepl-lightweight-client

Usage

import { DeepLClient } from 'deepl-lightweight-client';

const client = new DeepLClient('your-api-key');

const main = async () => {
  const usage = await client.usage();
  /**
   * { character_count: 368, character_limit: 500000 }
   */
  console.log(usage);

  const translation = await client.translateText('hello', 'EN', 'JA');
  /**
   * { detected_source_language: 'EN', text: 'こんにちわ' }
   */
  console.log(translation);

  const translations = await client.translateTextList(
    ['hello', 'world'],
    'EN',
    'JA'
  );
  /**
   * [
   *   { detected_source_language: 'EN', text: 'こんにちわ' },
   *   { detected_source_language: 'EN', text: '世界' }
   * ]
   */
  console.log(translations);
};

main();
0.0.7

2 years ago

0.0.6

2 years ago

0.0.4

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago