Skip to content

Commit

Permalink
Merge branch 'feature_alter' of github.com:AkaShark/Easydict into fea…
Browse files Browse the repository at this point in the history
…ture_alter
  • Loading branch information
AkaShark committed Feb 25, 2024
2 parents 145967c + 9e8d698 commit fcc2b92
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 21 deletions.
6 changes: 3 additions & 3 deletions Easydict/App/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "请确保已设置了触发 Easydict 的快捷!\n\n如需恢复,请在查词窗口使用快捷键 `Cmd + ,` 打开设置页,然后取消【隐藏菜单栏图标】选项。"
"value" : "请确保已设置了触发 Easydict 的快捷键!\n\n如需恢复,请在查词窗口使用快捷键 `Cmd + ,` 打开设置页,然后取消【隐藏菜单栏图标】选项。"
}
}
}
Expand Down Expand Up @@ -2340,13 +2340,13 @@
"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" : {
"stringUnit" : {
"state" : "translated",
"value" : "检测到当前并没有设置输入翻译快捷键或划词翻译快捷键!

请先设置快捷键确保可以触发Easydict再隐藏菜单栏图标。"
"value" : "检测到当前未设置输入翻译快捷键或划词翻译快捷键!\n\n请先设置快捷键确保可以触发 Easydict 再隐藏菜单栏图标。"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Easydict/Feature/Service/Apple/EZAppleService.m
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ - (EZLanguage)getMostConfidentLanguage:(NSDictionary<NLLanguage, NSNumber *> *)d
}
}
}
NSLog(@"Spell check failed, use Most Confident Language: %@", ezLanguage);
NSLog(@"No spell checking, use Most Confident Language: %@", ezLanguage);

return ezLanguage;
}
Expand Down
4 changes: 0 additions & 4 deletions Easydict/Feature/Service/Bing/EZBingService.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions Easydict/Feature/Service/Model/EZQueryService.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 5 additions & 10 deletions Easydict/Feature/Utility/EZCategory/NSString/NSString+EZUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Easydict/NewApp/Configuration/Configuration+Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extension Defaults.Keys {
static let clearInput = Key<Bool>("EZConfiguration_kClearInputKey", default: true)
static let keepPrevResultWhenEmpty = Key<Bool>("EZConfiguration_kKeepPrevResultKey", default: true)
static let selectQueryTextWhenWindowActivate = Key<Bool>("EZConfiguration_kSelectQueryTextWhenWindowActivate", default: false)
static let enableBetaNewApp = Key<Bool>("EZConfiguration_kEnableBetaNewAppKey", default: false)
static let enableBetaNewApp = Key<Bool>("EZConfiguration_kEnableBetaNewAppKey", default: true)

static let enableBetaFeature = Key<Bool>("EZBetaFeatureKey", default: false)

Expand Down

0 comments on commit fcc2b92

Please sign in to comment.