Skip to content
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

Add lingo-rep-raycast extension #16512

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

asashay
Copy link

@asashay asashay commented Jan 20, 2025

Description

The LingoRep Raycast extension makes it easy to translate text between languages. Anyone can use it for quick translations. Once you sign in, you can save your translations and use the spaced repetition algorithm in the web app to help memorize them effectively. More about it on the web site - https://lingorep.com/

Screencast

Screencast video

Checklist

- fix warnings
- fix lint errors
- prepare prod build
@raycastbot raycastbot added the new extension Label for PRs with new extensions label Jan 20, 2025
@raycastbot
Copy link
Collaborator

raycastbot commented Jan 20, 2025

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.

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi 👋

Thanks for your contribution 💪

I have now tested your extension, and I have some feedback ready for you:

  • Could you make a screencast of the flow so I can see how it works 😊

I'm looking forward to testing this extension again 🔥

Request a new review when you are ready. Feel free to contact me here or at Slack if you have any questions.

@pernielsentikaer pernielsentikaer self-assigned this Jan 24, 2025
asashay and others added 2 commits January 26, 2025 11:29
Co-authored-by: Per Nielsen Tikær <per@raycast.com>
Co-authored-by: Per Nielsen Tikær <per@raycast.com>
@asashay
Copy link
Author

asashay commented Jan 26, 2025

@pernielsentikaer thank you for getting back to me! I've added screencast and description - please check them out

Comment on lines 24 to 35
"copy:shared-packages": "./copy-shared-packages.sh",
"watch:translate": "chokidar '../../packages/translate/dist/**/*' -c 'npm run copy:shared-packages'",
"watch:lang-options": "chokidar '../../packages/lang-options/dist/**/*' -c 'npm run copy:shared-packages'",
"watch:shared-packages": "npm-run-all --parallel watch:translate watch:lang-options",
"npm:install": "npm install --prefix /Users/alex/Work/Projects/alex/lingo-rep-monorepo/apps/lingo-rep-raycast-extension",
"build": "npm run npm:install && ray build -e dist",
"dev:raycast": "ray develop",
"dev": "npm run npm:install && npm run copy:shared-packages && npm-run-all --parallel watch:shared-packages dev:raycast",
"dev-raycast": "",
"fix-lint": "ray lint --fix",
"lint": "ray lint",
"publish": "npx @raycast/api@latest publish"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just have the default ones?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pernielsentikaer changed, please take a look

@asashay asashay changed the title Add lingo-rep-raycast-extension extension Add lingo-rep-raycast extension Feb 4, 2025
@asashay
Copy link
Author

asashay commented Feb 4, 2025

hey @pernielsentikaer , I also shortened my repo URL from lingo-rep-raycast-extension.git to lingo-rep-raycast.git. I think it makes more sense from the readability stand point.

Will it be ok to publish it like that? Won't it cause issues when I submit new versions?
Is it better to close this one and resubmit it maybe?

@pernielsentikaer
Copy link
Collaborator

pernielsentikaer commented Feb 11, 2025

oAuth is not meant to be used like that with multiple services, did you see this page?

When I login I'm try to login it just ends in this view

Raycast 2025-02-11 at 08 26 48

Is there a reason why you need to login, it should more be a login to LingoRep.com?

@asashay
Copy link
Author

asashay commented Feb 11, 2025

hey @pernielsentikaer, thanks for getting back to me.

oAuth is not meant to be used like that with multiple services, did you see [this page](https://developers.raycast.com/api-reference/oauth)?
yes, I checked it when I implemented oAuth

I've made some changes - now after login user is redirected to the main view of the Raycast, please take a look.

As for the necessity of login - in our web app we use Google and Github to authenticate users. Thus I've implemented them here as well. Without being authenticated users won't be able to save translations to the database.

The idea is as following:

  • users translate and save words on their desktop using this Raycast extension
  • later they can review and repeat them in order to memorize them. This is done in the web extension

Cheers

@pernielsentikaer
Copy link
Collaborator

It feels a bit weird from a user perspective getting the actions when you're first entering the extension - I'm not sure if we can do anything to make this a better experience

@asashay
Copy link
Author

asashay commented Feb 13, 2025

hey @pernielsentikaer , could you elaborate more on feels a bit weird from a user perspective getting the actions when you're first entering the extension? I don't think I understand why it is an issue.

Currently, initial flow for user is:

  1. Install extension
  2. Configure language pairs
  3. Translate between them

Logging in - is optional step for user, if they want to save and repeat words later. That's what is suggested in the actions section

@pernielsentikaer
Copy link
Collaborator

It might be because I have no clue how it really works

Tried to login with Google and hit save and got this error:

21:25:47 error saving translation Error: No JWT provided
    at post (/Users/pernielsentikaer/.config/raycast/extensions/lingo-rep-raycast/index.js:37855:19)
    at saveTranslation (/Users/pernielsentikaer/.config/raycast/extensions/lingo-rep-raycast/index.js:38198:13)
    at A.onAction (/Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:20:9297)
    at v.batchedUpdates (/Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/react-reconciler/react-reconciler.production.min.js:7:49301)
    at /Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:13:3760
    at /Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:12:8258
    at new Promise (<anonymous>)
    at il (/Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:12:8098)
    at MessagePort.<anonymous> (/Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:7:696)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)
21:25:50 error saving translation Error: No JWT provided
    at post (/Users/pernielsentikaer/.config/raycast/extensions/lingo-rep-raycast/index.js:37855:19)
    at saveTranslation (/Users/pernielsentikaer/.config/raycast/extensions/lingo-rep-raycast/index.js:38198:13)
    at A.onAction (/Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:20:9297)
    at v.batchedUpdates (/Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/react-reconciler/react-reconciler.production.min.js:7:49301)
    at /Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:13:3760
    at /Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:12:8258
    at new Promise (<anonymous>)
    at il (/Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:12:8098)
    at MessagePort.<anonymous> (/Applications/Raycast.app/Contents/Resources/RaycastNodeExtensions_RaycastNodeExtensions.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:7:696)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)

Do you know what causes this?

@asashay
Copy link
Author

asashay commented Feb 14, 2025

hey @pernielsentikaer , thanks for details and for QAing it thoroughly!

It was a bug with authorization in my code. I just fixed it and pushed a new version.

Could you take a look?

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds a new LingoRep extension for Raycast that enables text translation with spaced repetition learning capabilities, featuring OAuth authentication and multi-language support.

  • The CHANGELOG.md should use {PR_MERGE_DATE} instead of a hardcoded date 2024-05-05
  • The extension uses an unofficial Google Translate API endpoint (client=gtx) in /src/shared-packages/translate/index.js which may have stability/usage limitations
  • The config.ts contains a commented "test" line that should be removed
  • The request.js implementation lacks proper error handling for HTTP requests
  • The README.md contains typos ("usign" should be "using") and could benefit from improved formatting

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

22 file(s) reviewed, 29 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -0,0 +1,3 @@
# LingoRep Changelog

## [Initial Version] - 2024-05-05
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Use {PR_MERGE_DATE} placeholder instead of hardcoded date. This will be automatically replaced with the current date when the PR is merged.

Suggested change
## [Initial Version] - 2024-05-05
## [Initial Version] - {PR_MERGE_DATE}

"axios": "1.7.2",
"hono": "^4.4.2",
"lodash": "^4.17.21",
"node-fetch": "^3.3.2",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Both axios and node-fetch are included - consider standardizing on one HTTP client

@@ -0,0 +1,20 @@
let nodeEnv = process.env.NODE_ENV as unknown as "development" | "production" | undefined;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Type assertion chain is unsafe. Consider using proper type guards or environment validation

weURL: "chrome-extension://gfmbkbpbncjopblehgldppphpkcmehnk/settings.html",
},
};
// test
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Remove empty test comment

Suggested change
// test

};
// test

export const config = allConfigs[nodeEnv];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Missing runtime check - config could be undefined if nodeEnv is invalid

Suggested change
export const config = allConfigs[nodeEnv];
if (!config) throw new Error(`Invalid environment: ${nodeEnv}`);
export const config = allConfigs[nodeEnv];

"Content-Type": "application/json",
},
data: data && method === "POST" ? JSON.stringify(data) : undefined,
url: url ? url : "",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Empty URL fallback could cause invalid requests. Consider throwing an error if URL is empty

Comment on lines +1 to +106
sq: string;
ar: string;
hy: string;
az: string;
eu: string;
be: string;
bn: string;
bs: string;
bg: string;
ca: string;
ceb: string;
ny: string;
"zh-cn": string;
"zh-tw": string;
co: string;
hr: string;
cs: string;
da: string;
nl: string;
eo: string;
et: string;
tl: string;
fi: string;
fr: string;
fy: string;
gl: string;
ka: string;
de: string;
el: string;
gu: string;
ht: string;
ha: string;
haw: string;
iw: string;
hi: string;
hmn: string;
hu: string;
is: string;
ig: string;
id: string;
ga: string;
it: string;
ja: string;
jw: string;
kn: string;
kk: string;
km: string;
ko: string;
ku: string;
ky: string;
lo: string;
la: string;
lv: string;
lt: string;
lb: string;
mk: string;
mg: string;
ms: string;
ml: string;
mt: string;
mi: string;
mr: string;
mn: string;
my: string;
ne: string;
no: string;
ps: string;
fa: string;
pl: string;
pt: string;
ma: string;
ro: string;
ru: string;
sm: string;
gd: string;
sr: string;
st: string;
sn: string;
sd: string;
si: string;
sk: string;
sl: string;
so: string;
su: string;
sw: string;
sv: string;
tg: string;
ta: string;
te: string;
th: string;
tr: string;
ur: string;
uz: string;
vi: string;
cy: string;
xh: string;
yi: string;
yo: string;
zu: string;
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: sourceLangOptions and sourceLangOptionsRaycast contain identical language mappings. Consider consolidating into a single shared object to reduce duplication.

Comment on lines +213 to +318
sq: string;
ar: string;
hy: string;
az: string;
eu: string;
be: string;
bn: string;
bs: string;
bg: string;
ca: string;
ceb: string;
ny: string;
"zh-cn": string;
"zh-tw": string;
co: string;
hr: string;
cs: string;
da: string;
nl: string;
eo: string;
et: string;
tl: string;
fi: string;
fr: string;
fy: string;
gl: string;
ka: string;
de: string;
el: string;
gu: string;
ht: string;
ha: string;
haw: string;
iw: string;
hi: string;
hmn: string;
hu: string;
is: string;
ig: string;
id: string;
ga: string;
it: string;
ja: string;
jw: string;
kn: string;
kk: string;
km: string;
ko: string;
ku: string;
ky: string;
lo: string;
la: string;
lv: string;
lt: string;
lb: string;
mk: string;
mg: string;
ms: string;
ml: string;
mt: string;
mi: string;
mr: string;
mn: string;
my: string;
ne: string;
no: string;
ps: string;
fa: string;
pl: string;
pt: string;
ma: string;
ro: string;
ru: string;
sm: string;
gd: string;
sr: string;
st: string;
sn: string;
sd: string;
si: string;
sk: string;
sl: string;
so: string;
su: string;
sw: string;
sv: string;
tg: string;
ta: string;
te: string;
th: string;
tr: string;
ur: string;
uz: string;
vi: string;
cy: string;
xh: string;
yi: string;
yo: string;
zu: string;
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: targetLangOptions and targetLangOptionsRaycast contain identical language mappings. Consider consolidating into a single shared object to reduce duplication.

fa: string;
pl: string;
pt: string;
ma: string;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: 'ma' appears to be an invalid ISO language code. Should likely be 'mr' for Marathi.

Suggested change
ma: string;
mr: string;

ht: string;
ha: string;
haw: string;
iw: string;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: 'iw' is a deprecated language code. Should use 'he' for Hebrew instead.

Suggested change
iw: string;
he: string;

@asashay asashay force-pushed the ext/lingo-rep-raycast-extension branch from 07d5b7e to 5cff160 Compare February 20, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new extension Label for PRs with new extensions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants