From 6816862c6f901f8e82f46df66008d36c602e8469 Mon Sep 17 00:00:00 2001 From: Jerry <89069957+Jerry23011@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:43:45 -0800 Subject: [PATCH 1/7] fix: typo in hide menubar prompt --- Easydict/App/Localizable.xcstrings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Easydict/App/Localizable.xcstrings b/Easydict/App/Localizable.xcstrings index 7b990e09a..4fa819908 100644 --- a/Easydict/App/Localizable.xcstrings +++ b/Easydict/App/Localizable.xcstrings @@ -1451,7 +1451,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "请确保已设置了触发 Easydict 的快捷!\n\n如需恢复,请在查词窗口使用快捷键 `Cmd + ,` 打开设置页,然后取消【隐藏菜单栏图标】选项。" + "value" : "请确保已设置了触发 Easydict 的快捷键!\n\n如需恢复,请在查词窗口使用快捷键 `Cmd + ,` 打开设置页,然后取消【隐藏菜单栏图标】选项。" } } } From 401bba0c7a0f2b32c8845d2bf8530516148aaa8d Mon Sep 17 00:00:00 2001 From: Tisfeng Date: Sun, 25 Feb 2024 10:28:08 +0800 Subject: [PATCH 2/7] fix: validate Bing service always fails (#422) * fix: validate Bing service always fail * perf: use from instead of self.queryModel.queryFromLanguage * perf: enable new SwiftUI Settings by default --- Easydict/Feature/Service/Bing/EZBingService.m | 4 ---- Easydict/Feature/Service/Model/EZQueryService.m | 4 ++-- Easydict/NewApp/Configuration/Configuration+Defaults.swift | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Easydict/Feature/Service/Bing/EZBingService.m b/Easydict/Feature/Service/Bing/EZBingService.m index 2b08d0ed1..5483b8200 100644 --- a/Easydict/Feature/Service/Bing/EZBingService.m +++ b/Easydict/Feature/Service/Bing/EZBingService.m @@ -104,10 +104,6 @@ - (BOOL)isEnglishWordToChinese:(NSString *)text from:(nonnull EZLanguage)from to } - (void)bingTranslate:(NSString *)text useDictQuery:(BOOL)useDictQuery from:(nonnull EZLanguage)from to:(nonnull EZLanguage)to completion:(nonnull void (^)(EZQueryResult *, NSError *_Nullable))completion { - if ([self prehandleQueryTextLanguage:text from:from to:to completion:completion]) { - return; - } - self.isDictQueryResult = NO; if (useDictQuery) { [self.request translateTextFromDict:text completion:^(NSDictionary * _Nullable json, NSError * _Nullable error) { diff --git a/Easydict/Feature/Service/Model/EZQueryService.m b/Easydict/Feature/Service/Model/EZQueryService.m index 2a1646fea..f73bd5275 100644 --- a/Easydict/Feature/Service/Model/EZQueryService.m +++ b/Easydict/Feature/Service/Model/EZQueryService.m @@ -178,8 +178,8 @@ - (BOOL)prehandleQueryTextLanguage:(NSString *)text } } - NSString *fromLanguage = [self languageCodeForLanguage:self.queryModel.queryFromLanguage]; - NSString *toLanguage = [self languageCodeForLanguage:self.queryModel.queryTargetLanguage]; + NSString *fromLanguage = [self languageCodeForLanguage:from]; + NSString *toLanguage = [self languageCodeForLanguage:to]; BOOL unsupportedLanguage = NO; diff --git a/Easydict/NewApp/Configuration/Configuration+Defaults.swift b/Easydict/NewApp/Configuration/Configuration+Defaults.swift index 240aed001..0c9b4d549 100644 --- a/Easydict/NewApp/Configuration/Configuration+Defaults.swift +++ b/Easydict/NewApp/Configuration/Configuration+Defaults.swift @@ -55,7 +55,7 @@ extension Defaults.Keys { static let clearInput = Key("EZConfiguration_kClearInputKey", default: true) static let keepPrevResultWhenEmpty = Key("EZConfiguration_kKeepPrevResultKey", default: true) static let selectQueryTextWhenWindowActivate = Key("EZConfiguration_kSelectQueryTextWhenWindowActivate", default: false) - static let enableBetaNewApp = Key("EZConfiguration_kEnableBetaNewAppKey", default: false) + static let enableBetaNewApp = Key("EZConfiguration_kEnableBetaNewAppKey", default: true) static let enableBetaFeature = Key("EZBetaFeatureKey", default: false) From 1eaa5ab2949572d822646d6e0b718b173a74d7e6 Mon Sep 17 00:00:00 2001 From: tisfeng Date: Sun, 25 Feb 2024 00:52:04 +0800 Subject: [PATCH 3/7] fix: check isEnglishWord method is wrong --- Easydict/Feature/Service/Apple/EZAppleService.m | 2 +- .../EZCategory/NSString/NSString+EZUtils.h | 1 + .../EZCategory/NSString/NSString+EZUtils.m | 15 +++++---------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Easydict/Feature/Service/Apple/EZAppleService.m b/Easydict/Feature/Service/Apple/EZAppleService.m index e2a681b15..cfad04389 100644 --- a/Easydict/Feature/Service/Apple/EZAppleService.m +++ b/Easydict/Feature/Service/Apple/EZAppleService.m @@ -752,7 +752,7 @@ - (EZLanguage)getMostConfidentLanguage:(NSDictionary *)d } } } - NSLog(@"Spell check failed, use Most Confident Language: %@", ezLanguage); + NSLog(@"No spell checking, use Most Confident Language: %@", ezLanguage); return ezLanguage; } diff --git a/Easydict/Feature/Utility/EZCategory/NSString/NSString+EZUtils.h b/Easydict/Feature/Utility/EZCategory/NSString/NSString+EZUtils.h index cea96945c..90f3965ab 100644 --- a/Easydict/Feature/Utility/EZCategory/NSString/NSString+EZUtils.h +++ b/Easydict/Feature/Utility/EZCategory/NSString/NSString+EZUtils.h @@ -58,6 +58,7 @@ static NSArray *const EZDashCharacterList = @[ @"—", @"-", @"–" ]; - (BOOL)isEnglishWordWithLanguage:(EZLanguage)language; +/// Just use regex to check English word, ^[a-zA-Z]+$ - (BOOL)isEnglishWord; - (BOOL)isEnglishWordWithMaxWordLength:(NSUInteger)maxWordLength; diff --git a/Easydict/Feature/Utility/EZCategory/NSString/NSString+EZUtils.m b/Easydict/Feature/Utility/EZCategory/NSString/NSString+EZUtils.m index 5a119c5df..9494781fe 100644 --- a/Easydict/Feature/Utility/EZCategory/NSString/NSString+EZUtils.m +++ b/Easydict/Feature/Utility/EZCategory/NSString/NSString+EZUtils.m @@ -246,16 +246,11 @@ - (BOOL)isEnglishWordWithMaxWordLength:(NSUInteger)maxWordLength { } - (BOOL)isEnglishPhrase { - if (self.length > EZEnglishWordMaxLength) { - return NO; - } - - NSInteger wordCount = [self wordCount]; - if (wordCount <= 2) { - return YES; - } - - return NO; + // hello word + NSString *text = [self stringByReplacingOccurrencesOfString:@" " withString:@""]; + BOOL isEnglishPhraseLength = [text isEnglishWordWithMaxWordLength:EZEnglishWordMaxLength * 2]; + BOOL isPhraseWordCount = [self wordCount] <= 2; + return isEnglishPhraseLength && isPhraseWordCount; } - (BOOL)isWord { From ce9e32ce1d6d6d7b28115221b37496a4a5a00e97 Mon Sep 17 00:00:00 2001 From: Sharker <1548742234@qq.com> Date: Sun, 25 Feb 2024 11:07:13 +0800 Subject: [PATCH 4/7] Update Easydict/App/Localizable.xcstrings Co-authored-by: phlpsong <103433299+phlpsong@users.noreply.github.com> --- Easydict/App/Localizable.xcstrings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Easydict/App/Localizable.xcstrings b/Easydict/App/Localizable.xcstrings index 4fa819908..80aa4192d 100644 --- a/Easydict/App/Localizable.xcstrings +++ b/Easydict/App/Localizable.xcstrings @@ -2346,7 +2346,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "检测到当前并没有设置输入翻译快捷键或划词翻译快捷键!

请先设置快捷键确保可以触发Easydict再隐藏菜单栏图标。" + "value" : "检测到当前并没有设置输入翻译快捷键或划词翻译快捷键!\n\n请先设置快捷键确保可以触发 Easydict 再隐藏菜单栏图标。" } } } From 7f0ca009f4afc5c6ce741e0c85da42717edf5a65 Mon Sep 17 00:00:00 2001 From: Sharker <1548742234@qq.com> Date: Sun, 25 Feb 2024 11:07:23 +0800 Subject: [PATCH 5/7] Update Easydict/App/Localizable.xcstrings Co-authored-by: phlpsong <103433299+phlpsong@users.noreply.github.com> --- Easydict/App/Localizable.xcstrings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Easydict/App/Localizable.xcstrings b/Easydict/App/Localizable.xcstrings index 80aa4192d..c365e1fc8 100644 --- a/Easydict/App/Localizable.xcstrings +++ b/Easydict/App/Localizable.xcstrings @@ -2340,7 +2340,7 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Now Detected that there is not set input translation shortcut key or selection translation shortcut key!\n
Set the shortcut key to make sure you can go Easydict and hide the menu bar icon." + "value" : "Now Detected that there is not set input translation shortcut key or selection translation shortcut key!\n\nSet the shortcut key to make sure you can go Easydict and hide the menu bar icon." } }, "zh-Hans" : { From 2558b398af9be8ea483f8d150f266c2698630148 Mon Sep 17 00:00:00 2001 From: Sharker <1548742234@qq.com> Date: Sun, 25 Feb 2024 03:12:44 +0000 Subject: [PATCH 6/7] fix: fix review localizable string --- Easydict/App/Localizable.xcstrings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Easydict/App/Localizable.xcstrings b/Easydict/App/Localizable.xcstrings index c365e1fc8..a6049f2fc 100644 --- a/Easydict/App/Localizable.xcstrings +++ b/Easydict/App/Localizable.xcstrings @@ -2346,7 +2346,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "检测到当前并没有设置输入翻译快捷键或划词翻译快捷键!\n\n请先设置快捷键确保可以触发 Easydict 再隐藏菜单栏图标。" + "value" : "检测到当前未设置输入翻译快捷键或划词翻译快捷键!\n\n请先设置快捷键确保可以触发 Easydict 再隐藏菜单栏图标" } } } From 9e8d69803d27dbcb40f030e573a3d577b28c0080 Mon Sep 17 00:00:00 2001 From: Sharker <1548742234@qq.com> Date: Sun, 25 Feb 2024 03:20:28 +0000 Subject: [PATCH 7/7] fix: fix localizable string --- Easydict/App/Localizable.xcstrings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Easydict/App/Localizable.xcstrings b/Easydict/App/Localizable.xcstrings index a6049f2fc..c40bbfff3 100644 --- a/Easydict/App/Localizable.xcstrings +++ b/Easydict/App/Localizable.xcstrings @@ -2346,7 +2346,7 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "检测到当前未设置输入翻译快捷键或划词翻译快捷键!\n\n请先设置快捷键确保可以触发 Easydict 再隐藏菜单栏图标" + "value" : "检测到当前未设置输入翻译快捷键或划词翻译快捷键!\n\n请先设置快捷键确保可以触发 Easydict 再隐藏菜单栏图标。" } } }