Skip to content

LegendaryEmoji/papago-translate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

Papago-translate is an efficient easy-to-use translator using Naver Papago.

  • Quick to learn
  • Highly maintained and Great support
  • Detailed documentation

Installation

Node.js 16.11.x or higher is recommended.
(Made on Node.js v18.10.0)

npm i discord.js

Example Usage

Importing library

const { Papago } = require("papago-translate");
const client = new Papago();

Example: Translate from Korean to English:

client.translate({
    from: "ko",
    to: "en",
    text: "빈민가에 사는 쓸모없는 골칫덩이, 그라티아."
}).then((response) => {
    console.log(response.result.translation);
}).catch(console.error);
// -> Gratia, a useless nuisance living in a slum.

Example: Detect Language of the text:

client.detectLanguage("빈민가에 사는 쓸모없는 골칫덩이, 그라티아.")
.then(console.log).catch(console.error);
// -> { error: false, result: "ko", valid: true }

Example: Get information about single word or multiple words.

client.define({
    from: "ko",
    to: "en",
    text: "줄거리"
}).then(console.log).catch(console.error);
// -> { error: false, result: { is_word: true, examples: [...], items: [ {...} ] } };

client.define({
    from: "en",
    to: "ko",
    text: "Organic Plot"
}).then(console.log).catch(console.error);
// -> { error: false, result: { is_word: false, examples: [], items: [ {...}, {...} ] } }

Documentation

You can find documentation here!

For any issue or contribution, please check the GitHub repository here!

About

An NPM package for using NAVER Papago Translator

Topics

Resources

License

Stars

Watchers

Forks