meta-translate

1.3.0 • Public • Published

MetaTranslate

Free translate Any text to any language

Install

via npm

$ npm install meta-translate --save

Use

Get supported languages

const metaTranslate = require('meta-translate');

const supportedLanguages = await metaTranslate.getSupported()
console.log(supportedLanguages)

//Output:
//['en','fr','ar'...]

Single translate

const metaTranslate = require('meta-translate');

const text = "My name is MetaTranslate"

// Simple syntax:
const translation = await metaTranslate.translate(text, { from: 'en', to: 'fr' });
const translation = await metaTranslate.translate(text, { to: 'fr' });
 
// Method chaining:
const translation = await metaTranslate.translate(text).from('en').to('fr');
const translation = await metaTranslate.translate(text).to('fr'); 

console.log(translation)
//Output:
//"Je m'appelle MetaTranslate"

Many text translate

const metaTranslate = require('meta-translate');

const texts = ["My name is MetaTranslate", "MetaTranslate is useful"]

// Simple syntax:
const translations = await metaTranslate.translate(texts, { from: 'en', to: 'fr' });
const translations = await metaTranslate.translate(texts, { to: 'fr' });
 
// Method chaining:
const translations = await metaTranslate.translate(texts).from('en').to('fr');
const translations = await metaTranslate.translate(texts).to('fr'); 

console.log(translations)
//Output:
//["Je m'appelle MetaTranslate", "MetaTranslate est utile"]

NOTE

DISCLAIMER: this is an unofficial library using the web API of Bing Microsoft Translator and also is not associated with Bing.

  • The maximum character limit on a single text is 5k.
  • Due to limitations of the web version of bing microsoft translator, this API does not guarantee that the library would work properly at all times (so please use this library if you don't care about stability).
  • If you want to use a stable API, I highly recommend you to use Microsoft's official Bing Translator API.

License

ISC

Copyright (c) 2021-present, Chipdeals Inc.

Package Sidebar

Install

npm i meta-translate

Weekly Downloads

0

Version

1.3.0

License

ISC

Unpacked Size

15.1 kB

Total Files

10

Last publish

Collaborators

  • euler8100