How to use the translate.text function in translate

To help you get started, we’ve selected a few translate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Marak / say.js / examples / demo-translate.js View on Github external
/* 
  check out the translate.js project for more information
  http://github.com/marak/translate.js/

  requires installing the translate.js module via
  
  sudo npm install translate

*/

var say = require('../lib/say');
var translate = require('translate');

translate.text('Yo quero tacos por favor', function(result){
  say.speak('Alex', result);
});
github chrisl8 / ArloBot / node / node_modules / say / examples / demo-translate.js View on Github external
/* 
  check out the translate.js project for more information
  http://github.com/marak/translate.js/

  requires installing the translate.js module via
  
  sudo npm install translate

*/

var say = require('../lib/say');
var translate = require('translate');

translate.text('Yo quero tacos por favor', function(result){
  say.speak('Alex', result);
});
github nodejitsu / kohai / lib / plugins / translate.js View on Github external
this.triggers.translate = function(name,to,message,languages,text) {
    //figure out who to respond to
    //if it was a private message to me, respond to the person
    //if it was to a room and not me specificall, reply in the room
    var destination = to === this.nick
      ? name
      : to
    
    var client = this
    if(text) {
      var pair = languages.split(/[:]/)

      translate.text({input:pair[0],output:pair[1]},text,function(txt) {
        //respond with the translated test, decoding the html entities
        client.say(destination,html.decode(txt))
      })
    }
    else {
      translate.text(languages,function(txt) {
        //respond with the translated test, decoding the html entities
        client.say(destination,html.decode(txt))
      })  
    }
  }
}
github nodejitsu / kohai / lib / plugins / translate.js View on Github external
//if it was to a room and not me specificall, reply in the room
    var destination = to === this.nick
      ? name
      : to
    
    var client = this
    if(text) {
      var pair = languages.split(/[:]/)

      translate.text({input:pair[0],output:pair[1]},text,function(txt) {
        //respond with the translated test, decoding the html entities
        client.say(destination,html.decode(txt))
      })
    }
    else {
      translate.text(languages,function(txt) {
        //respond with the translated test, decoding the html entities
        client.say(destination,html.decode(txt))
      })  
    }
  }
}
github chrisl8 / ArloBot / node / node_modules / say / node_modules / translate / examples / string.js View on Github external
var t = require('translate');
t.text("this is a test", function(err, txt) { 
  console.log(txt); 
});
  
t.text("this isn't a test", function(err, txt) { 
  console.log(txt); 
});
github chrisl8 / ArloBot / node / node_modules / say / node_modules / translate / examples / string.js View on Github external
var t = require('translate');
t.text("this is a test", function(err, txt) { 
  console.log(txt); 
});
  
t.text("this isn't a test", function(err, txt) { 
  console.log(txt); 
});
github Ricket / nodebot / scripts / translate.js View on Github external
listen(regexFactory.startsWith("translate"), function(match, data, replyTo) {
    var msgMatch = /^([^ ]+) (.*)$/.exec(match[1]);

    if (msgMatch) {
        translate.text({input: 'English', output: match[1]}, match[2], function(err, translation) {
            irc.privmsg(replyTo, translation);
        });
    } else {
        irc.privmsg(replyTo, "Usage: translate {language} {word or phrase}");
    }
});

translate

Translate text to different languages on node.js and the browser

MIT
Latest version published 2 months ago

Package Health Score

65 / 100
Full package analysis