Skip to content

Commit

Permalink
refractor: remove GeminiTranslateType
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry23011 committed Jan 8, 2024
1 parent f89615c commit d48431f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 128 deletions.
4 changes: 0 additions & 4 deletions Easydict.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
A0B65CA0F31AC8ECFB8347CC /* Pods_EasydictTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 378E73A7EA8FC8FB9C975A63 /* Pods_EasydictTests.framework */; };
B87AC7E36367075BA5D13234 /* Pods_Easydict.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6372B33DFF803C7096A82250 /* Pods_Easydict.framework */; };
C415C0AD2B450D4800A9D231 /* GeminiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C415C0AC2B450D4800A9D231 /* GeminiService.swift */; };
C415C0B22B45258600A9D231 /* GeminiTranslateType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C415C0B12B45258600A9D231 /* GeminiTranslateType.swift */; };
C4DD01E92B12B3C80025EE8E /* TencentService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4DD01E82B12B3C80025EE8E /* TencentService.swift */; };
C4DD01EB2B12BA250025EE8E /* TencentResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4DD01EA2B12BA250025EE8E /* TencentResponse.swift */; };
C4DD01ED2B12BE9B0025EE8E /* TencentTranslateType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4DD01EC2B12BE9B0025EE8E /* TencentTranslateType.swift */; };
Expand Down Expand Up @@ -731,7 +730,6 @@
9672D7D12B4008B40023B8FB /* MASShortcutBinder+EZMASShortcutBinder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "MASShortcutBinder+EZMASShortcutBinder.m"; sourceTree = "<group>"; };
A230E9A2358C7FBC7FB26189 /* Pods-EasydictTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EasydictTests.debug.xcconfig"; path = "Target Support Files/Pods-EasydictTests/Pods-EasydictTests.debug.xcconfig"; sourceTree = "<group>"; };
C415C0AC2B450D4800A9D231 /* GeminiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeminiService.swift; sourceTree = "<group>"; };
C415C0B12B45258600A9D231 /* GeminiTranslateType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeminiTranslateType.swift; sourceTree = "<group>"; };
C4DD01E82B12B3C80025EE8E /* TencentService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TencentService.swift; sourceTree = "<group>"; };
C4DD01EA2B12BA250025EE8E /* TencentResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TencentResponse.swift; sourceTree = "<group>"; };
C4DD01EC2B12BE9B0025EE8E /* TencentTranslateType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TencentTranslateType.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2099,7 +2097,6 @@
isa = PBXGroup;
children = (
C415C0AC2B450D4800A9D231 /* GeminiService.swift */,
C415C0B12B45258600A9D231 /* GeminiTranslateType.swift */,
);
path = Gemini;
sourceTree = "<group>";
Expand Down Expand Up @@ -2696,7 +2693,6 @@
6220AD5B2A82812300BBFB52 /* EZBingService.m in Sources */,
039F5508294B6E29004AB940 /* EZAboutViewController.m in Sources */,
03D8A6592A42A1A300D9A968 /* EZAppModel.m in Sources */,
C415C0B22B45258600A9D231 /* GeminiTranslateType.swift in Sources */,
036E7D7B293F4FC8002675DF /* EZOpenLinkButton.m in Sources */,
276742092B3DC230002A2C75 /* AboutTab.swift in Sources */,
03008B2E2941956D0062B821 /* EZURLSchemeHandler.m in Sources */,
Expand Down
11 changes: 9 additions & 2 deletions Easydict/Feature/Service/Gemini/GeminiService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,19 @@ public final class GeminiService: QueryService {
NSLocalizedString("gemini_translate", comment: "The name of Gemini Translate")
}

// https://ai.google.dev/available_regions
private static let unsupportedLanguages: [Language] = [.persian, .filipino, .khmer, .lao, .malay, .mongolian, .burmese, .telugu, .tamil, .urdu]

override public func supportLanguagesDictionary() -> MMOrderedDictionary<AnyObject, AnyObject> {
// TODO: Replace MMOrderedDictionary.
let orderedDict = MMOrderedDictionary<AnyObject, AnyObject>()
GeminiTranslateType.supportLanguagesDictionary.forEach { key, value in
orderedDict.setObject(value as NSString, forKey: key.rawValue as NSString)
for language in EZLanguageManager.shared().allLanguages {
var value = language.rawValue
if !GeminiService.unsupportedLanguages.contains(language) {
orderedDict.setObject(value as NSString, forKey: language.rawValue as NSString)
}
}

return orderedDict
}

Expand Down
Loading

0 comments on commit d48431f

Please sign in to comment.