Skip to content

Gamatek/node-reverso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 

Repository files navigation

Reverso Translation

The reverso module provides a simple way to translate text using the Reverso.net API. It supports translation between various languages and provides options for enhancing translation quality.

Installation

Before using the reverso module, make sure you have the required dependency installed in your project:

npm install axios

Usage

  1. Import the necessary constants and function:
const { reverso, ReversoLanguages } = require('./reverso'); // Replace with the actual path
  1. Choose the languages for translation using the ReversoLanguages constant:
const sourceLanguage = ReversoLanguages.English;
const targetLanguage = ReversoLanguages.French;
  1. Translate text using the reverso function:
const inputText = "Hello, how are you?";
reverso(inputText, sourceLanguage, targetLanguage)
    .then(translation => {
        console.log(`Translation: ${translation}`);
    })
    .catch(error => {
        console.error('Translation error:', error);
    });
  1. The reverso function takes an additional optional parameter, options, which allows you to customize translation behavior:
const translationOptions = {
    sentenceSplitter: true,
    origin: "translation.web",
    contextResults: true,
    languageDetection: true
};

reverso(inputText, sourceLanguage, targetLanguage, translationOptions)
    .then(translation => {
        console.log(`Translation: ${translation}`);
    })
    .catch(error => {
        console.error('Translation error:', error);
    });

Supported Languages

The ReversoLanguages constant provides language codes for various languages that are supported by the Reverso.net API. You can use these codes to specify the source and target languages for translation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published