feat(google-translate): add Google Translate integration#3337
feat(google-translate): add Google Translate integration#3337waleedlatif1 merged 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds a Google Translate integration with two operations: translate text and detect language. The implementation uses Google Cloud Translation API v2 with API key authentication passed as a query parameter (the correct method for this API).
The documentation already addresses the missing input parameters issue mentioned in previous threads. Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User Input] --> B{Operation Type}
B -->|text| C[google_translate_text]
B -->|detect| D[google_translate_detect]
C --> E[Build Request]
D --> F[Build Request]
E --> G{Source Language?}
G -->|Specified| H[Include source in body]
G -->|Auto-detect| I[Omit source from body]
H --> J[Add apiKey to URL query]
I --> J
F --> J
J --> K[POST to Google Translation API v2]
K --> L{Response}
L -->|Success| M[Transform Response]
L -->|Error| N[Return Error]
M --> O{Operation}
O -->|text| P[Return translatedText + detectedSourceLanguage]
O -->|detect| Q[Return language + confidence]
Last reviewed commit: f383aa5 |
30ccd46 to
f383aa5
Compare
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| { label: 'Turkish', id: 'tr' }, | ||
| { label: 'Dutch', id: 'nl' }, | ||
| { label: 'Polish', id: 'pl' }, | ||
| ], |
There was a problem hiding this comment.
Source language dropdown missing 18 languages from target
Medium Severity
The source language dropdown only has 16 language options (English through Polish), while the target language dropdown has 34 options. This appears to be an accidental truncation — 18 languages (Swedish, Thai, Vietnamese, Indonesian, Ukrainian, Czech, Greek, Hebrew, Romanian, Hungarian, Danish, Finnish, Norwegian, Bengali, Malay, Filipino, Swahili, Urdu) are available as targets but not as explicit source languages. Users translating from these languages can't specify them and must rely on auto-detect.
Additional Locations (1)
| url: (params) => { | ||
| const url = new URL('https://translation.googleapis.com/language/translate/v2') | ||
| url.searchParams.set('key', params.apiKey) | ||
| return url.toString() |
There was a problem hiding this comment.
Missing .trim() on API key, unlike other Google tools
Low Severity
The params.apiKey value is used without .trim() when constructing the API URL. Every other Google API tool in the codebase (Google Maps, Google Books, etc.) consistently calls params.apiKey.trim() before setting the key in the URL. This inconsistency means whitespace in the API key input could cause authentication failures only for Google Translate.
Additional Locations (1)
* feat(google-translate): add Google Translate integration * fix(google-translate): api key as query param, fix docsLink, rename tool file
* feat(workflow): lock/unlock workflow from context menu and panel * lint * fix(workflow): prevent duplicate lock notifications, no-op guard, fix orphaned JSDoc * improvement(workflow): memoize hasLockedBlocks to avoid inline recomputation * feat(google-translate): add Google Translate integration (#3337) * feat(google-translate): add Google Translate integration * fix(google-translate): api key as query param, fix docsLink, rename tool file * feat(google): add missing tools for Gmail, Drive, Sheets, and Calendar (#3338) * feat(google): add missing tools for Gmail, Drive, Sheets, and Calendar * fix(google-drive): remove dead transformResponse from move tool * feat(confluence): return page content in get page version tool (#3344) * feat(confluence): return page content in get page version tool * lint * feat(api): audit log read endpoints for admin and enterprise (#3343) * feat(api): audit log read endpoints for admin and enterprise * fix(api): address PR review — boolean coercion, cursor validation, detail scope * ran lint * unified list of languages for google translate * fix(workflow): respect snapshot view for panel lock toggle, remove unused disableAdmin prop * improvement(canvas-menu): remove lock icon from workflow lock toggle * feat(audit): record audit log for workflow lock/unlock
* feat(workflow): lock/unlock workflow from context menu and panel * lint * fix(workflow): prevent duplicate lock notifications, no-op guard, fix orphaned JSDoc * improvement(workflow): memoize hasLockedBlocks to avoid inline recomputation * feat(google-translate): add Google Translate integration (#3337) * feat(google-translate): add Google Translate integration * fix(google-translate): api key as query param, fix docsLink, rename tool file * feat(google): add missing tools for Gmail, Drive, Sheets, and Calendar (#3338) * feat(google): add missing tools for Gmail, Drive, Sheets, and Calendar * fix(google-drive): remove dead transformResponse from move tool * feat(confluence): return page content in get page version tool (#3344) * feat(confluence): return page content in get page version tool * lint * feat(api): audit log read endpoints for admin and enterprise (#3343) * feat(api): audit log read endpoints for admin and enterprise * fix(api): address PR review — boolean coercion, cursor validation, detail scope * ran lint * unified list of languages for google translate * fix(workflow): respect snapshot view for panel lock toggle, remove unused disableAdmin prop * improvement(canvas-menu): remove lock icon from workflow lock toggle * feat(audit): record audit log for workflow lock/unlock


Summary
Type of Change
Testing
Tested manually
Checklist