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

🐞 Bug Report: Apple Dict doesn't work in some languages #677

Closed
5 of 6 tasks
windrunner414 opened this issue Sep 16, 2024 · 5 comments
Closed
5 of 6 tasks

🐞 Bug Report: Apple Dict doesn't work in some languages #677

windrunner414 opened this issue Sep 16, 2024 · 5 comments
Assignees
Labels
bug Something isn't working fixed in next release The issue will be closed once next release is available

Comments

@windrunner414
Copy link

Please confirm the following:

  • Be sure to check out FAQ
  • I have carefully read the README
  • I have searched through the issues page but couldn't find a solution.(Including issue that has been closed)
  • Easydict has been upgraded to the latest version
  • I understand and agree to the above, and understand that the project maintainer has limited energy, issues that do not follow the rules may be ignored or closed directly

Problem description

Apple Dict in Easydict returns no result when the query text contains hiragana/katakana (Japanese) or some Swedish letters (å, ä, ö). I only tested Japanese and Swedish, it's possible that all characters other than Chinese and Latin don't work.
For example, はなし:
超級クラウン中日辞典 / クラウン日中辞典 (the built-in one in apple dictionary):
Screenshot 2024-09-16 at 3 45 49 AM
Easydict:
Screenshot 2024-09-16 at 3 46 21 AM

However, 話 will return the correct results
Screenshot 2024-09-16 at 3 48 15 AM

Is the issue consistently reproducible?

Reproducible

Steps to Reproduce

  1. Enabling 超級クラウン中日辞典 / クラウン日中辞典 in Apple Dictionary
  2. Quering any word contains hiragana, e.g. はなし. Apple Dictionary will show the correct result but Easydict will say no result

Screenshot

Screenshot 2024-09-16 at 3 46 21 AM

Runtime log(zip file)

Sorry there are too many menu icons on my laptop and the easydict one is not showing up, I'll try to get the log later

Expected result

Easydict shows the correct result as Apple Dictionary does

Proposed solution (optional)

No response

Device type and OS version

Apple M1 Pro, MacOS 14.6.1

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

  • I'm willing to submit a PR to fix this issue
@windrunner414 windrunner414 added the bug Something isn't working label Sep 16, 2024
Copy link

Hello windrunner414, Thank you for your first issue contribution 🎉

@windrunner414
Copy link
Author

windrunner414 commented Sep 16, 2024

Just had a look into code. Maybe it doesn't even query the dictionary because word count > 1
https://github.com/tisfeng/Easydict/blob/main/Easydict/objc/Service/Apple/AppleDictionary/EZAppleDictionary.m#L126

- (EZQueryTextType)queryTypeWithLanguage:(EZLanguage)language maxWordCount:(NSInteger)maxWordCount {

It appears Chinese bypasses the word count check in shouldQueryDictionaryWithLanguage so it works for Chinese. Not sure why Swedish "välkommen" also returns no result, maybe the word count is not accurate for Swedish?

I don't have a dev environment to debug it now, I probably can take a closer look some time later though.
It may be better to have a setting allowing it to always query in dictionary?

@tisfeng
Copy link
Owner

tisfeng commented Sep 17, 2024

ok, I'll take a look at it later.

@tisfeng
Copy link
Owner

tisfeng commented Sep 18, 2024

This is a bug.

The Apple dictionary query should not call the queryTypeWithLanguage method here because this method is incomplete. Initially, I only considered Chinese and English, and it is not suitable for other languages, such as Japanese.

I have removed this check #681, and the next version will fix it.

@tisfeng tisfeng self-assigned this Sep 18, 2024
@tisfeng tisfeng added the fixed in next release The issue will be closed once next release is available label Sep 18, 2024
@tisfeng
Copy link
Owner

tisfeng commented Nov 3, 2024

Hello, the new version 2.10.0 has fixed this issue.

@tisfeng tisfeng closed this as completed Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next release The issue will be closed once next release is available
Projects
None yet
Development

No branches or pull requests

2 participants