From 9973e74a19bde9307f3a1f43c30834e43bd23c2e Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Tue, 6 Dec 2022 17:21:04 +0800 Subject: [PATCH] Shared // Add KeyboardParser.localizedName variable. --- .../Sources/Shared/Shared.swift | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/Packages/vChewing_Shared/Sources/Shared/Shared.swift b/Packages/vChewing_Shared/Sources/Shared/Shared.swift index daf0613a..6f49b29a 100644 --- a/Packages/vChewing_Shared/Sources/Shared/Shared.swift +++ b/Packages/vChewing_Shared/Sources/Shared/Shared.swift @@ -161,13 +161,13 @@ public enum StateType: String { public enum KeyboardParser: Int, CaseIterable { case ofStandard = 0 case ofETen = 1 - case ofHsu = 2 - case ofETen26 = 3 case ofIBM = 4 case ofMiTAC = 5 + case ofSeigyou = 8 case ofFakeSeigyou = 6 case ofDachen26 = 7 - case ofSeigyou = 8 + case ofETen26 = 3 + case ofHsu = 2 case ofStarlight = 9 case ofHanyuPinyin = 10 case ofSecondaryPinyin = 11 @@ -175,6 +175,29 @@ public enum KeyboardParser: Int, CaseIterable { case ofHualuoPinyin = 13 case ofUniversalPinyin = 14 + public var localizedMenuName: String { + let rawString: String = { + switch self { + case .ofStandard: return "Dachen (Microsoft Standard / Wang / 01, etc.)" + case .ofETen: return "Eten Traditional" + case .ofIBM: return "IBM" + case .ofMiTAC: return "MiTAC" + case .ofSeigyou: return "Seigyou" + case .ofFakeSeigyou: return "Fake Seigyou" + case .ofDachen26: return "Dachen 26 (libChewing)" + case .ofETen26: return "Eten 26" + case .ofHsu: return "Hsu" + case .ofStarlight: return "Starlight" + case .ofHanyuPinyin: return "Hanyu Pinyin with Numeral Intonation" + case .ofSecondaryPinyin: return "Secondary Pinyin with Numeral Intonation" + case .ofYalePinyin: return "Yale Pinyin with Numeral Intonation" + case .ofHualuoPinyin: return "Hualuo Pinyin with Numeral Intonation" + case .ofUniversalPinyin: return "Universal Pinyin with Numeral Intonation" + } + }() + return NSLocalizedString(rawString, comment: "") + } + public var name: String { switch self { case .ofStandard: