translatium-legacy icon indicating copy to clipboard operation
translatium-legacy copied to clipboard

Add translation of selected text by hotkey

Open sEpt0r opened this issue 3 years ago • 6 comments

Resolve https://github.com/webcatalog/translatium-desktop/issues/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 avatar Jun 15 '21 21:06 sEpt0r

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

quanglam2807 avatar Jun 16 '21 04:06 quanglam2807

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",

sEpt0r avatar Jun 16 '21 08:06 sEpt0r

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.

quanglam2807 avatar Jun 16 '21 08:06 quanglam2807

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

sEpt0r avatar Jun 16 '21 09:06 sEpt0r

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.

sEpt0r avatar Jun 16 '21 14:06 sEpt0r