Skip to content

Commit e2348f7

Browse files
committed
get keyboard display name; hallelujah i18n
1 parent 8b01e2b commit e2348f7

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

ipc/ipc.swift

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,31 @@ public func openURL(_ urlString: String) {
99
}
1010
}
1111

12+
public struct KeyboardInfo {
13+
public let id: String
14+
public let displayName: String
15+
}
16+
1217
public func listKeyboards() -> [String] {
18+
listKeyboardInfo().map { $0.id }
19+
}
20+
21+
public func listKeyboardInfo() -> [KeyboardInfo] {
1322
let pluginsURL = appBundleUrl.appendingPathComponent("PlugIns")
14-
var result = [String]()
23+
var result = [KeyboardInfo]()
1524
if let items = try? FileManager.default.contentsOfDirectory(
1625
at: pluginsURL,
1726
includingPropertiesForKeys: nil,
1827
options: [.skipsHiddenFiles])
1928
{
2029
for item in items where item.pathExtension == "appex" {
21-
result.append(item.deletingPathExtension().lastPathComponent)
30+
let id = item.deletingPathExtension().lastPathComponent
31+
let displayName =
32+
Bundle(url: item)?.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String ?? id
33+
result.append(KeyboardInfo(id: id, displayName: displayName))
2234
}
2335
}
24-
return result
36+
return result.sorted { $0.id < $1.id }
2537
}
2638

2739
public func requestReload() {

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ if (HALLELUJAH)
118118
# copy_to(Hallelujah copy "${HALLELUJAH_SOURCE_DIR}/data/cedict.json" "share/hallelujah/cedict.json")
119119
copy_to(Hallelujah copy "${HALLELUJAH_BINARY_DIR}/src/hallelujah-addon.conf" "${ADDON_PREFIX}/hallelujah.conf")
120120
copy_to(Hallelujah copy "${HALLELUJAH_BINARY_DIR}/src/hallelujah.conf" "${IM_PREFIX}/hallelujah.conf")
121+
122+
install_cxx_translations("engines/fcitx5-hallelujah/po")
121123
endif()
122124

123125
if (MOZC)

0 commit comments

Comments
 (0)