tisfeng / Easydict

一个简洁优雅的词典翻译 macOS App。开箱即用,支持离线 OCR 识别,支持有道词典,🍎 苹果系统词典,🍎 苹果系统翻译,OpenAI,Gemini,DeepL,Google,Bing,腾讯,百度,阿里,小牛,彩云和火山翻译。A concise and elegant Dictionary and Translator macOS App for looking up words and translating text.
GNU General Public License v3.0
6.85k stars 347 forks source link

Arc Browser: Insert doesn't work from "Select Translate" #622

Closed simonbcn closed 3 weeks ago

simonbcn commented 1 month ago

Please confirm the following:

Problem description

Arc Browser. When I select text within an input field and press the icon or key combination for "Select Translate", the mini-window with the translation opens and there is a button that allows me to replace the selected text with the translation but it does nothing.

Is the issue consistently reproducible?

Reproducible

Steps to Reproduce

Arc Browser. When I select text within an input field and press the icon or key combination for "Select Translate", the mini-window with the translation opens and there is a button that allows me to replace the selected text with the translation but it does nothing.

Screenshot

Captura de pantalla 2024-07-28 a las 9 19 35

Expected result

It should replace the selected text with the translation.

Proposed solution (optional)

No response

Device type and OS version

macOS 14.5

Are you willing to submit a PR to fix this issue?

github-actions[bot] commented 1 month ago

Hello simonbcn, Thank you for your first issue contribution 🎉

tisfeng commented 1 month ago

I'm not using Arc Browser, @Jerry23011 can you help look at this?

Jerry23011 commented 1 month ago

I can reproduce the issue. e.g. On google.com, input “test” in the search field, then select text, and replace with translated text. Works on Safari but not Arc

tisfeng commented 1 month ago

Arc Browser behaves strangely, it may not support Accessibility, I will try to fix it later 😓

simonbcn commented 1 month ago

Arc Browser is based on Chromium, like most current browsers.

tisfeng commented 1 month ago

I tested and found that using the Accessibility method to replace translations on Arc Browser returns successful results, but the actual replacement operation fails, which is strange. It behaves differently from Chrome in some ways.

I added an option to ensure that replacement is successful on Arc Browser https://github.com/tisfeng/Easydict/pull/624 .

tisfeng commented 3 weeks ago

Version 2.8.0 has fixed this issue.

simonbcn commented 3 weeks ago

It still fails.

Jerry23011 commented 3 weeks ago

Turn on Replace translation with compatibility mode in advanced settings @simonbcn

simonbcn commented 3 weeks ago

It doesn't work either. Paste the content into the easydict application window:

Captura de pantalla 2024-08-17 a las 9 18 45

Jerry23011 commented 3 weeks ago

Could you give me the website that didn’t work for you?

simonbcn commented 3 weeks ago

This: github.

Jerry23011 commented 3 weeks ago

It works for me. Could you upload a screen recording to reproduce the issue? Thanks

https://github.com/user-attachments/assets/514024b3-0b53-4ec4-9499-1d644cb9bb1c

simonbcn commented 3 weeks ago

https://github.com/user-attachments/assets/a4cb6017-67aa-4d35-9a73-e963a16b8001

Jerry23011 commented 3 weeks ago

CC @tisfeng Not sure what's going on here. I can't reproduce the issue with the exact same operations.

@simonbcn Meanwhile, I suggest uninstalling Easydict completely (including the cache, config files, and permission settings) and reinstall it to see if the issue persists. This is to see if the issue happens due to an environment variable on your local macOS.

tisfeng commented 3 weeks ago

@simonbcn First, make sure you have the "Use Replace with Translation in compatibility mode" option turned on.

Also, could you please provide the Easydict log zip file(menu icon -> Help -> Export log) and we'll check it out.

99367
tisfeng commented 3 weeks ago

I watched the video carefully and noticed a strange point: after clicking the replace button, the Easydict window should be hidden automatically (this is very important), just like shown in @Jerry23011's video.

@simonbcn I'm not sure why your window didn't hide; can you check it?

simonbcn commented 3 weeks ago

I have uninstalled the application with CleanMyMac. I have done a search on the disk for "easydict" and I have deleted the folders/files that had that name. I have restarted the system and reinstalled the application, now it works correctly.

Jerry23011 commented 3 weeks ago

Great to hear that! This could be caused by a data race error where user data is corrupted. We might want to migrate the project to Swift 6 in the future to prevent that.

MilchstraB commented 2 weeks ago

I found that I had to turn on the forced word option to successfully open the translation button in Arc browser.

tisfeng commented 2 weeks ago

No, testing on my computer, Arc supports Accessibility to obtain selected text, which means that it can work without enabling forced word retrieval.

I rarely use Arc and am not familiar with it, so I'm not sure if there is a problem with Arc, because I found that some of its behaviors are different from Chrome, for example, https://github.com/tisfeng/Easydict/issues/622#issuecomment-2256359689.

MilchstraB commented 2 weeks ago

Thanks for your reply! My question is shown in the video. The machine I used was the M2 Macbook Air with MacOS 14.6.1, Arc Browser 1.56.0 and Easydict 2.8.1.

https://github.com/user-attachments/assets/6f128c5f-d349-4648-95b1-93f5c962e261

Jerry23011 commented 2 weeks ago

Very interesting. It works on my end as well without enabling force get text.

@MilchstraB How about try resetting your Easydict Accessibility permissions.

I'm on macOS 14.6.1 | Easydict 2.8.1 | Arc 1.56.0

https://github.com/user-attachments/assets/858b2e06-cb46-4b31-8800-166de65d18cd

MilchstraB commented 2 weeks ago

It's very interesting. I tried to reinstall the APP and reset the permissions for word translation, and only the button that turns on the forced text selection seemed to work for me. If this option is not turned on, text cannot be correctly selected in the sidebar even if the shortcut option + D is used. However, it has little effect on use.

tisfeng commented 2 weeks ago

@MilchstraB You can upload the Easydict zip runtime log. It might be helpful.