Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce Translate API #1023

Merged
merged 1 commit into from
Jan 4, 2016

Conversation

stephenplusplus
Copy link
Contributor

Fixes #977

To Dos

  • Enable Translate API for Travis account
  • Set env var in Travis for API key
  • Docs
  • Tests
    • Unit
    • System

Preview

var gcloud = require('gcloud');

var translate = gcloud.translate({
  key: 'API Key'
});

// Translate a string of text.
translate.translate('Hello', 'es', function(err, translation) {
  if (!err) {
    // translation = 'Hola'
  }
});

// Detect a language from a string of text.
translate.detect('Hello', function(err, results) {
  if (!err) {
    // results = {
    //   language: 'en',
    //   confidence: 1,
    //   input: 'Hello'
    // }
  }
});

// Get a list of supported languages.
translate.getLanguages(function(err, languages) {
  if (!err) {
    // languages = [
    //   'af',
    //   'ar',
    //   'az',
    //   ...
    // ]
  }
});

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 15, 2015
@stephenplusplus stephenplusplus force-pushed the spp--translate branch 2 times, most recently from 0d3ac92 to 12d1d4a Compare December 15, 2015 17:59
@stephenplusplus stephenplusplus added the api: translate Issues related to the Cloud Translation API. label Dec 15, 2015
@stephenplusplus
Copy link
Contributor Author

@callmehiphop PTAQL. This one's pretty small. I just want to be sure I'm not doing anything too crazy before locking it up with the unit tests.

* }
* });
*/
Translate.prototype.translate = function(input, language, callback) {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@callmehiphop
Copy link
Contributor

@stephenplusplus LGTM :) unit test away!

@stephenplusplus
Copy link
Contributor Author

Thanks for the review!

var gcloud = require('gcloud');

var translate = gcloud.translate({
key: 'API Key'

This comment was marked as spam.

This comment was marked as spam.

@jgeewax
Copy link
Contributor

jgeewax commented Dec 16, 2015

/cc @ilsung

Does Translate work with service account credentials (ie, keyfile.json) ?

@stephenplusplus
Copy link
Contributor Author

Tests added: stephenplusplus@1ebcde0

@stephenplusplus stephenplusplus added the status: blocked Resolving the issue is dependent on other work. label Dec 22, 2015
@stephenplusplus
Copy link
Contributor Author

Marking as blocked until we hear from @ilsung about authenticating with a service account keyfile. (Thanks in advance for your help!)

@ilsung
Copy link

ilsung commented Jan 4, 2016

Sorry for the delay -- No, the Translate API does not support service account creds since it doesn't use OAuth. A key is required.

@stephenplusplus stephenplusplus removed the status: blocked Resolving the issue is dependent on other work. label Jan 4, 2016
@stephenplusplus
Copy link
Contributor Author

Thanks for clearing that up.

@callmehiphop if this LGTY, merge away.

callmehiphop added a commit that referenced this pull request Jan 4, 2016
@callmehiphop callmehiphop merged commit 00dfae9 into googleapis:master Jan 4, 2016
@callmehiphop
Copy link
Contributor

🍰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: translate Issues related to the Cloud Translation API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants