From ed454b0c48b11fe4ca82e6ae1d8af072ca77cade Mon Sep 17 00:00:00 2001 From: Tisfeng Date: Tue, 14 Nov 2023 10:07:54 +0800 Subject: [PATCH] Update Easydict/Feature/Service/Caiyun/CaiyunService.swift Co-authored-by: Kyle --- Easydict/Feature/Service/Caiyun/CaiyunService.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Easydict/Feature/Service/Caiyun/CaiyunService.swift b/Easydict/Feature/Service/Caiyun/CaiyunService.swift index 45b177f12..4462f8368 100644 --- a/Easydict/Feature/Service/Caiyun/CaiyunService.swift +++ b/Easydict/Feature/Service/Caiyun/CaiyunService.swift @@ -26,10 +26,14 @@ public final class CaiyunService: QueryService { override public func supportLanguagesDictionary() -> MMOrderedDictionary { // TODO: Replace MMOrderedDictionary in the API let orderedDict = MMOrderedDictionary() - 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) + let dic: [Language: String] = [ + .auto: "auto", + .simplifiedChinese: "zh", + .english: "en", + .japanese: "ja", + ] + dic.forEach { key, value in + orderedDict.setObject(value as NSString, forKey: key.rawValue as NSString) } return orderedDict }