Skip to content

ROTranslationTools/ytrans.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ytrans.js Build Status NPM

Usage:

  • If you don't already have one, get an API key here
    var ytrans = require('ytrans.js');
    var yt = new ytrans();
    yt.set_key(API_KEY);

    yt.translate('Hello there!', function(err, result) {
        ...;
    });
    yt.set_default_lang("sk", function(err, success) {
        if (err || ! success)
            console.log("Failed to set the default language: look at results ", arguments);
        else
            console.log("Successfully set the default language!");
    });
    yt.translate({
        text: ['кофе', 'Я знаю, французской и правда'], lang: 'de'
    }, function(err, translation) {
        ...;
    });
    var ytk = new ytrans({api_key_path: API_KEY_PATH});
    ytk.get_allowed_translations("uk", function(err, secondaries) {
        ...;
    });
    var ytk1 = new ytrans(API_KEY_PATH);
    ytk1.translate_file({
        path: TARGET_FILE, lang: 'cs-ru'
    }, function(err, content) {
        ...;
    });

    ytk1.is_allowed_transition("ru", "ch", function(err, validity) {
        ...;
    });
    var catfish = new ytrans(API_KEY_PATH);
    catfish.translate({
        text: ["Je sais espagnol pour de vrai, je suis couché LOL"], lang: "es"
    }, function(err, res) {
        ...;
    });

About

NodeJS unofficial Yandex translator API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%