mgcodeur / super-translator

Translate text from any language to any language for free using (Google Translate, DeepL, Yandex Translate, Bing Translator)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation

  1. Install the package
npm i @mgcodeur/super-translator@latest
  1. Import the module
import translate from '@mgcodeur/super-translator';

Basic Usage

import translate from '@mgcodeur/super-translator';

const result = await translate({
    from: 'en',
    to: 'es',
    text: 'Hello World!'
});

console.log(result);
// output: Hola mundo

Auto detect language

Nb: "from" is not required, if not specified, it will be automatically detected

Example:

import translate from '@mgcodeur/super-translator';

const result = await translate({
    to: 'ja',
    text: 'Hello World!'
});

console.log(result);
// output: こんにちは世界

Note: if "to" is not specified, it will be "en"

Don't forget to add type="module" in your package.json file

{
  "type": "module"
  ...
}

You can run this with command:

node your-file.js

About

Translate text from any language to any language for free using (Google Translate, DeepL, Yandex Translate, Bing Translator)


Languages

Language:JavaScript 100.0%