-
Notifications
You must be signed in to change notification settings - Fork 592
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
translate: api updates #1781
translate: api updates #1781
Conversation
@stephenplusplus @jgeewax @omaray @bjwatson The thing I'm missing here is the model parameter, my understanding is that it is in beta and users will have to be whitelisted to use it. Do we want to cut a separate release to support this parameter? It's just a string, so I think we could probably get away with just adding it here and making note that users need to be whitelisted to use it. WDYT? |
Can you link to any docs on what the model property is? |
@stephenplusplus I'm not sure any exists yet :( but it would essentially just be a string that the user supplies. |
Seeing an e2e failure, not sure if it's an actual error or not. If we send the word Hello! to be translated into Spanish it comes back as ¡Hola!. (This is expected). However when we send the same text in the form of html |
@callmehiphop I've pinged @akeran to see if he has any thoughts on that behavior. |
If you set format=html you will get "\u003cbody\u003e ¡Hola! \u003c/body\u003e" |
Which test?
|
@akeran the assertion we made actually included the html tags wrapping the content - however, it would appear the issue I was seeing disappeared at some point in the night! |
@@ -312,6 +312,9 @@ Translate.prototype.getLanguages = function(target, callback) { | |||
* is written in. | |||
* @param {string} options.to - The ISO 639-1 language code to translate the | |||
* input to. | |||
* @param {string} options.model - **Note:** Users must be whitelisted to use |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
It's also possible to authenticate with an API key. To create an API key: | ||
|
||
1. Visit the [Google Developers Console][dev-console]. | ||
2. 2. Create a new project or click on an existing project. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -305,6 +312,9 @@ Translate.prototype.getLanguages = function(target, callback) { | |||
* is written in. | |||
* @param {string} options.to - The ISO 639-1 language code to translate the | |||
* input to. | |||
* @param {string} options.model - **Note:** Users must be whitelisted to use |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
} | ||
|
||
var translate = new Translate(extend({}, env, { key: API_KEY })); | ||
describe('translate', function() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -38,9 +42,16 @@ var fakeUtil = extend({}, util, { | |||
} | |||
}); | |||
|
|||
function FakeService() { | |||
this.calledWith_ = arguments; | |||
Service.apply(this, arguments); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
}); | ||
|
||
it('should localize the api key', function() { | ||
assert.equal(translate.key, KEY_OPTIONS.key); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
}, /An API key is required to use the Translate API\./); | ||
}); | ||
it('should inherit from Service', function() { | ||
assert(translate instanceof Service); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Changes Unknown when pulling 023359d on callmehiphop:translate-updates into * on GoogleCloudPlatform:master*. |
baseUrl: baseUrl, | ||
scopes: ['https://www.googleapis.com/auth/cloud-platform'], | ||
packageJson: require('../package.json'), | ||
projectIdRequired: false |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -303,6 +310,9 @@ Translate.prototype.getLanguages = function(target, callback) { | |||
* not, we set the format as `text`. | |||
* @param {string} options.from - The ISO 639-1 language code the source input | |||
* is written in. | |||
* @param {string} options.model - **Note:** Users must be whitelisted to use | |||
* this parameter. Set the model type requested for this translation. Please | |||
* refer to the upstread documentation for possible values. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -381,16 +391,20 @@ Translate.prototype.translate = function(input, options, callback) { | |||
if (options.to) { | |||
query.target = options.to; | |||
} | |||
|
|||
if (options.model) { | |||
query.model = options.model; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
a: 'b', | ||
c: 'd', | ||
qs: { | ||
beforeEach(function() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Changes Unknown when pulling b68c187 on callmehiphop:translate-updates into * on GoogleCloudPlatform:master*. |
Please re-assign if it needs another look. |
The most notable change with this request is that ap keys are no longer required and users can now authenticate in a similar fashion to our other APIs.
TODO