Skip to content

Commit

Permalink
perf: improve caiyun supported langauges dict
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng committed Nov 13, 2023
1 parent 1d044c9 commit d9de4e4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Easydict/Feature/Service/Caiyun/CaiyunService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ public final class CaiyunService: QueryService {
override public func supportLanguagesDictionary() -> MMOrderedDictionary<AnyObject, AnyObject> {
// TODO: Replace MMOrderedDictionary in the API
let orderedDict = MMOrderedDictionary<AnyObject, AnyObject>()
orderedDict.setObject("auto" as NSString, forKey: Language.auto.rawValue as NSString)
orderedDict.setObject("zh" as NSString, forKey: Language.simplifiedChinese.rawValue as NSString)
orderedDict.setObject("en" as NSString, forKey: Language.english.rawValue as NSString)
orderedDict.setObject("ja" as NSString, forKey: Language.japanese.rawValue as NSString)
let keys = ["auto", "zh", "en", "ja"]
let values = [Language.auto, Language.simplifiedChinese, Language.english, Language.japanese]
for (index, key) in keys.enumerated() {
orderedDict.setObject(key as NSString, forKey: values[index].rawValue as NSString)
}
return orderedDict
}

Expand Down

0 comments on commit d9de4e4

Please sign in to comment.