diff --git a/Easydict/Feature/Service/Caiyun/CaiyunService.swift b/Easydict/Feature/Service/Caiyun/CaiyunService.swift index c65e47078..45b177f12 100644 --- a/Easydict/Feature/Service/Caiyun/CaiyunService.swift +++ b/Easydict/Feature/Service/Caiyun/CaiyunService.swift @@ -26,10 +26,11 @@ public final class CaiyunService: QueryService { override public func supportLanguagesDictionary() -> MMOrderedDictionary { // TODO: Replace MMOrderedDictionary in the API let orderedDict = MMOrderedDictionary() - 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 }