Skip to content

Commit

Permalink
perf: optimize and localize error handling in unsupported languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry23011 committed Nov 29, 2023
1 parent 7b671d3 commit f95c6e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Easydict/Feature/Service/Tencent/TencentService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ public final class TencentService: QueryService {
if prehandleQueryTextLanguage(text, autoConvertChineseText: false, from: from, to: to, completion: completion) {
return
}
let transType = TencentTranslateType.type(from: from, to: to)
let transType = TencentTranslateType.transType(from: from, to: to)
guard transType != .unsupported else {
result.errorType = .unsupportedLanguage
result.errorMessage = "不支持的翻译类型: \(from.rawValue) --> \(to.rawValue)"
let unsupportedType = NSLocalizedString("unsupported_translation_type", comment: "")
result.errorMessage = "\(unsupportedType): \(from.rawValue) --> \(to.rawValue)"
completion(result, nil)
return
}
Expand Down

0 comments on commit f95c6e6

Please sign in to comment.