IME // Refactor kanjiConversionIfRequired().
This commit is contained in:
parent
47cd0949a2
commit
ebf59b594c
|
@ -40,16 +40,14 @@ public enum IME {
|
|||
static var currentInputMode: InputMode = .init(rawValue: mgrPrefs.mostRecentInputMode) ?? .imeModeNULL
|
||||
|
||||
static func kanjiConversionIfRequired(_ text: String) -> String {
|
||||
if currentInputMode == InputMode.imeModeCHT {
|
||||
switch (mgrPrefs.chineseConversionEnabled, mgrPrefs.shiftJISShinjitaiOutputEnabled) {
|
||||
case (false, true): return ChineseConverter.cnvTradToJIS(text)
|
||||
case (true, false): return ChineseConverter.cnvTradToKangXi(text)
|
||||
// 本來這兩個開關不該同時開啟的,但萬一被同時開啟了的話就這樣處理:
|
||||
case (true, true): return ChineseConverter.cnvTradToJIS(text)
|
||||
case (false, false): return text
|
||||
}
|
||||
guard currentInputMode == InputMode.imeModeCHT else { return text }
|
||||
switch (mgrPrefs.chineseConversionEnabled, mgrPrefs.shiftJISShinjitaiOutputEnabled) {
|
||||
case (false, true): return ChineseConverter.cnvTradToJIS(text)
|
||||
case (true, false): return ChineseConverter.cnvTradToKangXi(text)
|
||||
// 本來這兩個開關不該同時開啟的,但萬一被同時開啟了的話就這樣處理:
|
||||
case (true, true): return ChineseConverter.cnvTradToJIS(text)
|
||||
case (false, false): return text
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
// MARK: - 自 ctlInputMethod 讀取當前輸入法的簡繁體模式
|
||||
|
|
Loading…
Reference in New Issue