Skip to content

Commit

Permalink
Merge branch 'dev' into feature_alter
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng authored Feb 25, 2024
2 parents 6816862 + 1eaa5ab commit be5ff82
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 18 deletions.
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 be5ff82

Please sign in to comment.