Skip to content

Commit b68c187

Browse files
committed
minor fixes per PR feedback
1 parent 023359d commit b68c187

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

packages/translate/src/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ Translate.prototype.getLanguages = function(target, callback) {
312312
* is written in.
313313
* @param {string} options.model - **Note:** Users must be whitelisted to use
314314
* this parameter. Set the model type requested for this translation. Please
315-
* refer to the upstread documentation for possible values.
315+
* refer to the upstream documentation for possible values.
316316
* @param {string} options.to - The ISO 639-1 language code to translate the
317317
* input to.
318318
* @param {function} callback - The callback function.
@@ -376,35 +376,35 @@ Translate.prototype.getLanguages = function(target, callback) {
376376
Translate.prototype.translate = function(input, options, callback) {
377377
input = arrify(input);
378378

379-
var query = {
379+
var body = {
380380
q: input,
381381
format: options.format || (isHtml(input[0]) ? 'html' : 'text')
382382
};
383383

384384
if (is.string(options)) {
385-
query.target = options;
385+
body.target = options;
386386
} else {
387387
if (options.from) {
388-
query.source = options.from;
388+
body.source = options.from;
389389
}
390390

391391
if (options.to) {
392-
query.target = options.to;
392+
body.target = options.to;
393393
}
394394

395395
if (options.model) {
396-
query.model = options.model;
396+
body.model = options.model;
397397
}
398398
}
399399

400-
if (!query.target) {
400+
if (!body.target) {
401401
throw new Error('A target language is required to perform a translation.');
402402
}
403403

404404
this.request({
405405
method: 'POST',
406406
uri: '',
407-
json: query
407+
json: body
408408
}, function(err, resp) {
409409
if (err) {
410410
callback(err, null, resp);
@@ -413,7 +413,7 @@ Translate.prototype.translate = function(input, options, callback) {
413413

414414
var translations = resp.data.translations.map(prop('translatedText'));
415415

416-
if (query.q.length === 1) {
416+
if (body.q.length === 1) {
417417
translations = translations[0];
418418
}
419419

packages/translate/test/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ describe('Translate', function() {
101101
'https://www.googleapis.com/auth/cloud-platform'
102102
]);
103103
assert.deepEqual(calledWith.packageJson, require('../package.json'));
104+
assert.strictEqual(calledWith.projectIdRequired, false);
104105
});
105106

106107
describe('Using an API Key', function() {

0 commit comments

Comments
 (0)