-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Add deeplx-translate extension #24350
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
base: main
Are you sure you want to change the base?
Conversation
|
Congratulations on your new Raycast extension! 🚀 Due to our current reduced availability, the initial review may take up to 10-15 business days. Once the PR is approved and merged, the extension will be available on our Store. |
Greptile OverviewGreptile SummaryThis PR adds a new DeepLX Translate extension for Raycast that provides translation functionality using the DeepLX API. The extension includes a single view-type command with a form interface for translating text between multiple languages. Key Changes
Critical Issues FoundLogic Errors:
Syntax/Compliance Issues:
Recommendations
Confidence Score: 1/5
Important Files ChangedFile Analysis
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 files reviewed, 8 comments
| Icon, | ||
| } from "@raycast/api"; | ||
| import { useState } from "react"; | ||
| import fetch from "node-fetch"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not import fetch from node-fetch in Node.js 21+, as fetch is a built-in global API. Since this extension uses Node.js 22+ (as indicated by the @types/node version 22.13.10), the fetch API is available natively.
| import fetch from "node-fetch"; | |
| // Remove this import - fetch is built-in in Node.js 21+ |
| interface Preferences { | ||
| apiEndpoint: string; | ||
| apiKey?: string; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't manually define Preferences interface for getPreferenceValues(). These types are auto-generated in raycast-env.d.ts when the extension runs. Manual definitions can become out of sync with your actual configuration in package.json.
| interface Preferences { | |
| apiEndpoint: string; | |
| apiKey?: string; | |
| } | |
| // Remove this manual interface - use auto-generated types from raycast-env.d.ts |
| const detectedTargetLang = targetLang === "auto" ? detectLanguage(text) : targetLang; | ||
| const finalTargetLang = detectedTargetLang || "EN"; // Fallback to English if detection fails | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is incorrect. The code detects the language of the input text and uses it as the target language. This means if the input is Chinese, it would translate Chinese→Chinese, which doesn't make sense.
Auto-detection should only apply to the source language. The target language should always be explicitly selected by the user. The "auto" option should be removed from the target language dropdown (line 157).
| </Form.Dropdown> | ||
|
|
||
| <Form.Dropdown id="targetLang" title="Target Language" value={targetLang} onChange={setTargetLang}> | ||
| <Form.Dropdown.Item value="auto" title="Auto Detect" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The target language dropdown should not have an "auto" option. Auto-detection only makes sense for the source language, not the target. Remove this line.
| <Form.Dropdown.Item value="auto" title="Auto Detect" /> | |
| <Form.Dropdown id="targetLang" title="Target Language" value={targetLang} onChange={setTargetLang}> |
| "$schema": "https://www.raycast.com/schemas/extension.json", | ||
| "name": "deeplx-translate", | ||
| "title": "DeepLX Translate", | ||
| "description": "use deeplx api translate", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description should be properly capitalized and grammatically correct. Current: "use deeplx api translate"
| "description": "use deeplx api translate", | |
| "description": "Translate text using the DeepLX API", |
| "dependencies": { | ||
| "@raycast/api": "^1.103.0", | ||
| "@raycast/utils": "^2.2.1", | ||
| "node-fetch": "^2.7.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dependency should be removed since fetch is built-in in Node.js 21+. Additionally, if node-fetch were needed, most extensions in this repository use v3 instead of v2.
| "node-fetch": "^2.7.0" | |
| // Remove node-fetch dependency - use built-in fetch |
| - Add copy translation results to clipboard | ||
| - Improve API settings instructions | ||
|
|
||
| ## [Initial Release] - 2026-01-10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The date "2026-01-10" is in the future. This should be "2025-01-10" or the actual release date.
| ## [Initial Release] - 2026-01-10 | |
| ## [Initial Release] - 2025-01-10 |
| "commands": [ | ||
| { | ||
| "name": "translate", | ||
| "title": "Translate", | ||
| "description": "Translate using DeepLX API", | ||
| "mode": "view", | ||
| "subtitle": "DeepLX Translation" | ||
| } | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extensions with view-type commands must include a metadata/ folder containing Raycast-styled screenshots. Currently, screenshots are in assets/screenshots/ but they should be in metadata/ instead.
The metadata folder should contain professionally styled screenshots following Raycast's store guidelines. See: https://developers.raycast.com/basics/prepare-an-extension-for-store#screenshots
Description
Screencast
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare placed outside of themetadatafolder