mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
⚡ Small improvements to Google Translate node
This commit is contained in:
@@ -114,8 +114,8 @@ export class GoogleTranslate implements INodeType {
|
|||||||
// All
|
// All
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
{
|
{
|
||||||
displayName: 'Query',
|
displayName: 'Text',
|
||||||
name: 'query',
|
name: 'text',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The input text to translate',
|
description: 'The input text to translate',
|
||||||
@@ -181,10 +181,10 @@ export class GoogleTranslate implements INodeType {
|
|||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
if (resource === 'language') {
|
if (resource === 'language') {
|
||||||
if (operation === 'translate') {
|
if (operation === 'translate') {
|
||||||
const query = this.getNodeParameter('query', i) as string;
|
const text = this.getNodeParameter('text', i) as string;
|
||||||
const translateTo = this.getNodeParameter('translateTo', i) as string;
|
const translateTo = this.getNodeParameter('translateTo', i) as string;
|
||||||
|
|
||||||
const response = await googleApiRequest.call(this, 'POST', `/language/translate/v2`, { q: query, target: translateTo });
|
const response = await googleApiRequest.call(this, 'POST', `/language/translate/v2`, { q: text, target: translateTo });
|
||||||
responseData.push(response.data.translations[0]);
|
responseData.push(response.data.translations[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user