Skip to content

Commit

Permalink
perf: add missing zh <--> zh-TW for Tencent translate
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng committed Jan 26, 2024
1 parent 4580d35 commit 2f8da58
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Easydict/Feature/Service/Tencent/TencentTranslateType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,16 @@ struct TencentTranslateType: Equatable {
]

static func transType(from: Language, to: Language) -> TencentTranslateType {
/**
1. zh <--> zh-TW
2. zh --> zh

Tencent Translate supports Simplified Chinese and Traditional Chinese translations of each other, but the documentation doesn't mention this, so we need to handle it ourselves.

In addition, it also supports one language as both source and target language if the language is supported.
*/
guard let targetLanguages = supportedTypes[from],
targetLanguages.contains(to) || from == to
targetLanguages.contains(to) || from == to || EZLanguageManager.shared().onlyContainsChineseLanguages([from, to])
else {
return .unsupported
}
Expand Down

0 comments on commit 2f8da58

Please sign in to comment.