ctlCandUniv. // Let candidates respect Chinese conversion settings.
This commit is contained in:
parent
ba9023cdbc
commit
bc428f2b04
|
@ -74,6 +74,11 @@ private class vwrCandidateUniversal: NSView {
|
||||||
|
|
||||||
@objc(setKeyLabels:displayedCandidates:)
|
@objc(setKeyLabels:displayedCandidates:)
|
||||||
func set(keyLabels labels: [String], displayedCandidates candidates: [String]) {
|
func set(keyLabels labels: [String], displayedCandidates candidates: [String]) {
|
||||||
|
let candidates = candidates.map { theCandidate -> String in
|
||||||
|
let theConverted = IME.kanjiConversionIfRequired(theCandidate)
|
||||||
|
return (theCandidate == theConverted) ? theCandidate : "\(theConverted)(\(theCandidate))"
|
||||||
|
}
|
||||||
|
|
||||||
let count = min(labels.count, candidates.count)
|
let count = min(labels.count, candidates.count)
|
||||||
keyLabels = Array(labels[0..<count])
|
keyLabels = Array(labels[0..<count])
|
||||||
displayedCandidates = Array(candidates[0..<count])
|
displayedCandidates = Array(candidates[0..<count])
|
||||||
|
@ -209,7 +214,9 @@ private class vwrCandidateUniversal: NSView {
|
||||||
}
|
}
|
||||||
case InputMode.imeModeCHT:
|
case InputMode.imeModeCHT:
|
||||||
if #available(macOS 12.0, *) {
|
if #available(macOS 12.0, *) {
|
||||||
activeCandidateAttr[.languageIdentifier] = "zh-Hant" as AnyObject
|
activeCandidateAttr[.languageIdentifier] =
|
||||||
|
(mgrPrefs.shiftJISShinjitaiOutputEnabled || mgrPrefs.chineseConversionEnabled)
|
||||||
|
? "ja" as AnyObject : "zh-Hant" as AnyObject
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
@ -279,7 +286,9 @@ private class vwrCandidateUniversal: NSView {
|
||||||
}
|
}
|
||||||
case InputMode.imeModeCHT:
|
case InputMode.imeModeCHT:
|
||||||
if #available(macOS 12.0, *) {
|
if #available(macOS 12.0, *) {
|
||||||
activeCandidateAttr[.languageIdentifier] = "zh-Hant" as AnyObject
|
activeCandidateAttr[.languageIdentifier] =
|
||||||
|
(mgrPrefs.shiftJISShinjitaiOutputEnabled || mgrPrefs.chineseConversionEnabled)
|
||||||
|
? "ja" as AnyObject : "zh-Hant" as AnyObject
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue