Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

feat: group the heard languages that still need a speech model under one line

wquguru71bb45c3efea
diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings
index b7cd5d7..de9cd4f 100644
--- a/Resources/en.lproj/Localizable.strings
+++ b/Resources/en.lproj/Localizable.strings
@@ -258,7 +258,6 @@
"结论" = "Conclusions";
"结论和待办" = "Conclusions and to-dos";
"人名和术语" = "Names and terms";
-" · 原识别 %@" = " · heard as %@";
"依据较少" = "Little evidence";
"依据 %lld 句" = "Evidence: %lld";
"%@ · %lld 句" = "%@ · %lld lines";
@@ -279,6 +278,9 @@
"译文" = "Translation";
"此刻" = "Now";
"等有人开口" = "Waiting for someone to speak";
+"收起" = "Hide";
+"展开全部 %lld 个" = "Show all %lld";
+" · 原识别 %@" = " · heard as %@";
"有人开口后,约半分钟出第一版" = "First notes about 30 s after someone speaks";
"会整理出" = "You'll get";
"待办" = "To-dos";
@@ -320,8 +322,6 @@
"韩" = "KO";
"自动" = "Auto";
"打开语言设置" = "Open language settings";
-"收起" = "Hide";
-"展开全部 %lld 个" = "Show all %lld";
"这场会议" = "This meeting";
"只改这一场,默认值在 设置 › 语言" = "Changes only this meeting; defaults are in Settings › Language";
"还没听出来" = "Not detected yet";
@@ -720,7 +720,7 @@
/* Views */
"自动识别(%@)" = "Auto-detect (%@)";
-"%@(需下载)" = "%@ (download needed)";
+"选中后自动下载语音模型" = "Downloads its speech model when chosen";
"系统" = "System";
"内容" = "Content";
"仅本场" = "This meeting";
diff --git a/Resources/ja.lproj/Localizable.strings b/Resources/ja.lproj/Localizable.strings
index 92361c6..fd65418 100644
--- a/Resources/ja.lproj/Localizable.strings
+++ b/Resources/ja.lproj/Localizable.strings
@@ -258,7 +258,6 @@
"结论" = "結論";
"结论和待办" = "結論とToDo";
"人名和术语" = "人名と用語";
-" · 原识别 %@" = " · 元の認識 %@";
"依据较少" = "根拠が少ない";
"依据 %lld 句" = "根拠 %lld文";
"%@ · %lld 句" = "%@ · %lld文";
@@ -279,6 +278,9 @@
"译文" = "翻訳";
"此刻" = "いま";
"等有人开口" = "誰かが話すのを待っています";
+"收起" = "たたむ";
+"展开全部 %lld 个" = "すべて表示(%lld 件)";
+" · 原识别 %@" = " · 元の認識 %@";
"有人开口后,约半分钟出第一版" = "話し始めて約30秒で最初のメモ";
"会整理出" = "まとめる内容";
"待办" = "ToDo";
@@ -320,8 +322,6 @@
"韩" = "韓";
"自动" = "自動";
"打开语言设置" = "言語設定を開く";
-"收起" = "たたむ";
-"展开全部 %lld 个" = "すべて表示(%lld 件)";
"这场会议" = "この会議";
"只改这一场,默认值在 设置 › 语言" = "この会議だけ変更します。既定値は 設定 › 言語";
"还没听出来" = "未検出";
@@ -720,7 +720,7 @@
/* Views */
"自动识别(%@)" = "自動検出(%@)";
-"%@(需下载)" = "%@(要ダウンロード)";
+"选中后自动下载语音模型" = "選ぶと音声モデルを自動ダウンロード";
"系统" = "システム";
"内容" = "内容";
"仅本场" = "この会議のみ";
diff --git a/Resources/ko.lproj/Localizable.strings b/Resources/ko.lproj/Localizable.strings
index e4d1479..4a61fd9 100644
--- a/Resources/ko.lproj/Localizable.strings
+++ b/Resources/ko.lproj/Localizable.strings
@@ -258,7 +258,6 @@
"结论" = "결론";
"结论和待办" = "결론 및 할 일";
"人名和术语" = "인명 및 용어";
-" · 原识别 %@" = " · 원래 인식 %@";
"依据较少" = "근거 적음";
"依据 %lld 句" = "근거 %lld문장";
"%@ · %lld 句" = "%@ · %lld문장";
@@ -279,6 +278,9 @@
"译文" = "번역문";
"此刻" = "지금";
"等有人开口" = "누군가 말하길 기다리는 중";
+"收起" = "접기";
+"展开全部 %lld 个" = "모두 보기 (%lld개)";
+" · 原识别 %@" = " · 원래 인식 %@";
"有人开口后,约半分钟出第一版" = "말을 시작하면 약 30초 뒤 첫 메모";
"会整理出" = "정리되는 것";
"待办" = "할 일";
@@ -320,8 +322,6 @@
"韩" = "한";
"自动" = "자동";
"打开语言设置" = "언어 설정 열기";
-"收起" = "접기";
-"展开全部 %lld 个" = "모두 보기 (%lld개)";
"这场会议" = "이 회의";
"只改这一场,默认值在 设置 › 语言" = "이 회의만 변경됩니다. 기본값은 설정 › 언어에 있습니다";
"还没听出来" = "아직 감지 못함";
@@ -720,7 +720,7 @@
/* Views */
"自动识别(%@)" = "자동 감지(%@)";
-"%@(需下载)" = "%@(다운로드 필요)";
+"选中后自动下载语音模型" = "선택하면 음성 모델을 자동 다운로드";
"系统" = "시스템";
"内容" = "내용";
"仅本场" = "이번 회의만";
diff --git a/Resources/zh-Hans.lproj/Localizable.strings b/Resources/zh-Hans.lproj/Localizable.strings
index b8b7332..5d034d3 100644
--- a/Resources/zh-Hans.lproj/Localizable.strings
+++ b/Resources/zh-Hans.lproj/Localizable.strings
@@ -258,7 +258,6 @@
"结论" = "结论";
"结论和待办" = "结论和待办";
"人名和术语" = "人名和术语";
-" · 原识别 %@" = " · 原识别 %@";
"依据较少" = "依据较少";
"依据 %lld 句" = "依据 %lld 句";
"%@ · %lld 句" = "%@ · %lld 句";
@@ -279,6 +278,9 @@
"译文" = "译文";
"此刻" = "此刻";
"等有人开口" = "等有人开口";
+"收起" = "收起";
+"展开全部 %lld 个" = "展开全部 %lld 个";
+" · 原识别 %@" = " · 原识别 %@";
"有人开口后,约半分钟出第一版" = "有人开口后,约半分钟出第一版";
"会整理出" = "会整理出";
"待办" = "待办";
@@ -320,8 +322,6 @@
"韩" = "韩";
"自动" = "自动";
"打开语言设置" = "打开语言设置";
-"收起" = "收起";
-"展开全部 %lld 个" = "展开全部 %lld 个";
"这场会议" = "这场会议";
"只改这一场,默认值在 设置 › 语言" = "只改这一场,默认值在 设置 › 语言";
"还没听出来" = "还没听出来";
@@ -720,7 +720,7 @@
/* Views */
"自动识别(%@)" = "自动识别(%@)";
-"%@(需下载)" = "%@(需下载)";
+"选中后自动下载语音模型" = "选中后自动下载语音模型";
"系统" = "系统";
"内容" = "内容";
"仅本场" = "仅本场";
diff --git a/Sources/LiveSubs/Views.swift b/Sources/LiveSubs/Views.swift
index 0b0c7b1..3fffc48 100644
--- a/Sources/LiveSubs/Views.swift
+++ b/Sources/LiveSubs/Views.swift
@@ -36,18 +36,39 @@ struct LogoTile: View {
var body: some View { BrandMark(size: size) }
}
+typealias ChoiceOption = (id: String, title: String)
+
/// A gray rounded row that opens a menu, used for the language choices.
struct ChoiceRow: View {
let label: String
let value: String
var badge: String? = nil
- let options: [(id: String, title: String)]
+ /// Groups the menu separates; a header is its grey section title.
+ let sections: [(header: String?, options: [ChoiceOption])]
let onPick: (String) -> Void
+ init(label: String, value: String, badge: String? = nil,
+ sections: [(header: String?, options: [ChoiceOption])], onPick: @escaping (String) -> Void) {
+ self.label = label; self.value = value; self.badge = badge
+ self.sections = sections.filter { !$0.options.isEmpty }
+ self.onPick = onPick
+ }
+
+ init(label: String, value: String, badge: String? = nil,
+ options: [ChoiceOption], onPick: @escaping (String) -> Void) {
+ self.init(label: label, value: value, badge: badge, sections: [(nil, options)], onPick: onPick)
+ }
+
var body: some View {
Menu {
- ForEach(options, id: \.id) { o in
- Button(o.title) { onPick(o.id) }
+ // Sections, not Dividers: the menu draws the separators itself, and a Divider next to
+ // a headed Section would draw a second one.
+ ForEach(sections.indices, id: \.self) { i in
+ if let header = sections[i].header {
+ Section(header) { buttons(sections[i].options) }
+ } else {
+ Section { buttons(sections[i].options) }
+ }
}
} label: {
HStack(spacing: 10) {
@@ -73,6 +94,12 @@ struct ChoiceRow: View {
.buttonStyle(.plain)
.menuIndicator(.hidden)
}
+
+ private func buttons(_ options: [ChoiceOption]) -> some View {
+ ForEach(options, id: \.id) { o in
+ Button(o.title) { onPick(o.id) }
+ }
+ }
}
// MARK: - Menu bar panel
@@ -81,11 +108,17 @@ struct MenuPanelView: View {
@ObservedObject var model: AppModel
@ObservedObject var settings: AppSettings
- private var sourceOptions: [(id: String, title: String)] {
+ /// Languages without a speech model on this Mac sit in their own group under one line saying
+ /// picking one downloads it, rather than a suffix on every row.
+ private var sourceSections: [(header: String?, options: [ChoiceOption])] {
let auto = model.candidates.map(\.name).joined(separator: "、")
- return [("auto", auto.isEmpty ? L("自动识别") : L("自动识别(\(auto))"))] + sourceLanguages.map {
- ($0.locale, model.installed.isEmpty || model.installed.contains($0.locale) ? $0.name : L("\($0.name)(需下载)"))
- }
+ let ready = sourceLanguages.filter { model.installed.isEmpty || model.installed.contains($0.locale) }
+ let missing = sourceLanguages.filter { !ready.contains($0) }
+ return [
+ (nil, [("auto", auto.isEmpty ? L("自动识别") : L("自动识别(\(auto))"))]),
+ (nil, ready.map { ($0.locale, $0.name) }),
+ (L("选中后自动下载语音模型"), missing.map { ($0.locale, $0.name) }),
+ ]
}
private var targetOptions: [(id: String, title: String)] {
@@ -132,7 +165,7 @@ struct MenuPanelView: View {
if let p = model.ending { MeetingEndingStrip(model: model, pending: p, compact: true) }
VStack(spacing: 8) {
- ChoiceRow(label: L("听到"), value: heardValue.0, badge: heardValue.1, options: sourceOptions) {
+ ChoiceRow(label: L("听到"), value: heardValue.0, badge: heardValue.1, sections: sourceSections) {
model.sourceSelection = $0
}
ChoiceRow(label: L("翻译成"),