Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

Add translation of selected text by hotkey #328

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

sEpt0r
Copy link

@sEpt0r sEpt0r commented Jun 15, 2021

Resolve #18

I added a new function to get and translate selected text in any window and an option to enable or disable this feature.

@sEpt0r sEpt0r changed the title Add translation of selected text by hotkey #18 Add translation of selected text by hotkey Jun 15, 2021
@quanglam2807
Copy link
Member

Thanks a lot for the PR, @sEpt0r. Currently, this is blocked because robotjs could not be built properly with elecctron. octalmage/robotjs#675

@sEpt0r
Copy link
Author

sEpt0r commented Jun 16, 2021

This command will rebuild the C ++ extensions for the version of electron you are using.

"rebuild": "npm rebuild --runtime=electron --target=12.0.11 --disturl=https://atom.io/download/atom-shell --abi=87",

@quanglam2807
Copy link
Member

This command will rebuild the C ++ extensions for the version of electron you are using.

"rebuild": "npm rebuild --runtime=electron --target=12.0.11 --disturl=https://atom.io/download/atom-shell --abi=87",

It wouldn't work in production. I don't know why but webpack and electron-builder doesn't recognize robotjs binary as valid.

@sEpt0r
Copy link
Author

sEpt0r commented Jun 16, 2021

I will try to find a workaround for this. I also see an error with the dist command.

@sEpt0r
Copy link
Author

sEpt0r commented Jun 16, 2021

With this fix, the webpack can compile the robotjs dependency and build the app. For MacOS, Accessibility permissions are required to retrieve selected text from other applications.

Also, consider splitting the settings for translating selected text and text from the clipboard, as I pushed in the initial PR.
In my case, I always have something in the clipboard and want to open an empty translation window without translating the clipboard using hotkeys if nothing is selected.

@quanglam2807
Copy link
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants