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.68k stars 338 forks source link

fix: validate Bing service always fails #422

Closed tisfeng closed 5 months ago

tisfeng commented 5 months ago

Fix https://github.com/tisfeng/Easydict/issues/421

tisfeng commented 5 months ago

Since refactoring startQuery:, we don't need to call prehandleQueryTextLanguage: method manually anymore.

- (void)startQuery:(EZQueryModel *)queryModel
        completion:(void (^)(EZQueryResult *result, NSError *_Nullable error))completion {
    NSString *queryText = queryModel.queryText;
    EZLanguage from = queryModel.queryFromLanguage;
    EZLanguage to = queryModel.queryTargetLanguage;

    if ([self prehandleQueryTextLanguage:queryText
                                    from:from
                                      to:to
                              completion:completion]) {
        return;
    }

    [self translate:queryText from:from to:to completion:completion];
}
tisfeng commented 5 months ago

I plan to release a small fix update tonight or tomorrow.

tisfeng commented 5 months ago

We need to speed up the Swift refactoring and turn it from an objc project into a Swift project.

Next, in order to better add new features later, I plan to rewrite the code related to the query service (excluding the services themselves), the previous code was a bit ugly, when we refactor it later, we should try our best to optimize it, making it easier to expand.

image