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(ios): says when translation can't be reached, and that a Ling key works without a proxy, while listening, importing and face to face

wquguru615a8aa96583
diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings
index ae5481e..9fe1591 100644
--- a/Resources/en.lproj/Localizable.strings
+++ b/Resources/en.lproj/Localizable.strings
@@ -1620,3 +1620,8 @@
"下拉控制中心,点左上角的 + 添加" = "Pull down Control Center and tap + at the top left to add it";
"“嘿 Siri,用%@开始听”" = "“Hey Siri, start listening with %@”";
"“嘿 Siri,%@结束”" = "“Hey Siri, stop %@”";
+
+/* iOS: translation can't be reached */
+"连不上翻译,%lld 句等连上后再翻" = "Can't reach translation · %lld lines wait for the connection";
+"连不上翻译,填 Ling key 后不用代理也能用" = "Can't reach translation. With a Ling key it works without a proxy";
+"网络连不上,连上后再说一次" = "No connection. Say it again once you're online";
diff --git a/Resources/ja.lproj/Localizable.strings b/Resources/ja.lproj/Localizable.strings
index b8325d4..16aca9f 100644
--- a/Resources/ja.lproj/Localizable.strings
+++ b/Resources/ja.lproj/Localizable.strings
@@ -1620,3 +1620,8 @@
"下拉控制中心,点左上角的 + 添加" = "コントロールセンターを下に引き、左上の + で追加";
"“嘿 Siri,用%@开始听”" = "「Hey Siri、%@ で聞き始めて」";
"“嘿 Siri,%@结束”" = "「Hey Siri、%@ を終了」";
+
+/* iOS: translation can't be reached */
+"连不上翻译,%lld 句等连上后再翻" = "翻訳に接続できません · %lld 文は接続後に翻訳";
+"连不上翻译,填 Ling key 后不用代理也能用" = "翻訳に接続できません。Ling key があればプロキシなしで使えます";
+"网络连不上,连上后再说一次" = "ネットワークに接続できません。接続後にもう一度話してください";
diff --git a/Resources/ko.lproj/Localizable.strings b/Resources/ko.lproj/Localizable.strings
index 85a1983..33b53f8 100644
--- a/Resources/ko.lproj/Localizable.strings
+++ b/Resources/ko.lproj/Localizable.strings
@@ -1620,3 +1620,8 @@
"下拉控制中心,点左上角的 + 添加" = "제어 센터를 내리고 왼쪽 위 +를 눌러 추가";
"“嘿 Siri,用%@开始听”" = "“시리야, %@로 듣기 시작”";
"“嘿 Siri,%@结束”" = "“시리야, %@ 종료”";
+
+/* iOS: translation can't be reached */
+"连不上翻译,%lld 句等连上后再翻" = "번역에 연결할 수 없음 · %lld개 문장은 연결 후 번역";
+"连不上翻译,填 Ling key 后不用代理也能用" = "번역에 연결할 수 없습니다. Ling key가 있으면 프록시 없이 사용할 수 있습니다";
+"网络连不上,连上后再说一次" = "네트워크에 연결할 수 없습니다. 연결되면 다시 말해 주세요";
diff --git a/Resources/zh-Hans.lproj/Localizable.strings b/Resources/zh-Hans.lproj/Localizable.strings
index c72547d..55f57bf 100644
--- a/Resources/zh-Hans.lproj/Localizable.strings
+++ b/Resources/zh-Hans.lproj/Localizable.strings
@@ -1525,3 +1525,8 @@
"下拉控制中心,点左上角的 + 添加" = "下拉控制中心,点左上角的 + 添加";
"“嘿 Siri,用%@开始听”" = "“嘿 Siri,用%@开始听”";
"“嘿 Siri,%@结束”" = "“嘿 Siri,%@结束”";
+
+/* iOS: translation can't be reached */
+"连不上翻译,%lld 句等连上后再翻" = "连不上翻译,%lld 句等连上后再翻";
+"连不上翻译,填 Ling key 后不用代理也能用" = "连不上翻译,填 Ling key 后不用代理也能用";
+"网络连不上,连上后再说一次" = "网络连不上,连上后再说一次";
diff --git a/ios/Sources/Cicada/CicadaApp.swift b/ios/Sources/Cicada/CicadaApp.swift
index e426e03..b9f9ba9 100644
--- a/ios/Sources/Cicada/CicadaApp.swift
+++ b/ios/Sources/Cicada/CicadaApp.swift
@@ -96,7 +96,16 @@ final class AppModel: ObservableObject {
@Published var store = SessionStore()
let ling = LingClient()
lazy var notes = NotesEngine(ling: ling, store: store)
- lazy var translator = TranslationService(ling: ling)
+ lazy var translator: TranslationService = {
+ let t = TranslationService(ling: ling)
+ t.onHealth = { [weak self] h in self?.translationHealth = h }
+ return t
+ }()
+ /// Whether translation can be reached: the live page, the import card and 面对面 say so.
+ @Published var translationHealth = TranslationHealth()
+ /// Finished sentences are going untranslated because nothing can be reached (no key, no
+ /// Google, no on-device model), so what is on screen is only the original.
+ var translationDown: Bool { translationHealth.googleDown && translationHealth.sentencesUntranslated }
lazy var room: RoomListen = {
let r = RoomListen(store: store, translator: translator, notes: notes)
r.onStateChange = { [weak self] in self?.listeningChanged() }
diff --git a/ios/Sources/Cicada/FaceToFace.swift b/ios/Sources/Cicada/FaceToFace.swift
index 10ddeeb..6ad5aa5 100644
--- a/ios/Sources/Cicada/FaceToFace.swift
+++ b/ios/Sources/Cicada/FaceToFace.swift
@@ -213,7 +213,9 @@ final class FaceToFace: ObservableObject {
// Never read out untranslated text (AGENTS.md).
guard phase == .translating(side) else { return }
phase = .idle
- problem = L("没翻译出来,再说一次")
+ // Nothing reachable and no key: saying it again won't help, a key (or a network) will.
+ problem = translator.health.googleDown && !ling.hasKey ? L("连不上翻译,填 Ling key 后不用代理也能用")
+ : translator.health.googleDown ? L("网络连不上,连上后再说一次") : L("没翻译出来,再说一次")
debugLog("face: translation failed")
return
}
diff --git a/ios/Sources/Cicada/Importing.swift b/ios/Sources/Cicada/Importing.swift
index d4df59e..b019805 100644
--- a/ios/Sources/Cicada/Importing.swift
+++ b/ios/Sources/Cicada/Importing.swift
@@ -222,7 +222,8 @@ struct ImportCard: View {
case .detecting: L("正在听是哪种语言…")
case .downloading(let name): L("正在下载 \(name) 语音模型…")
case .transcribing: L("文字记录已转到 \(TranscriptExport.clock(importer.heard)) / \(TranscriptExport.clock(importer.duration))")
- case .translating: L("还有 \(importer.untranslated) 句在翻译")
+ case .translating:
+ model.translationDown ? L("连不上翻译,\(importer.untranslated) 句等连上后再翻") : L("还有 \(importer.untranslated) 句在翻译")
}
}
}
diff --git a/ios/Sources/Cicada/LiveViews.swift b/ios/Sources/Cicada/LiveViews.swift
index 5db0db6..00ec75e 100644
--- a/ios/Sources/Cicada/LiveViews.swift
+++ b/ios/Sources/Cicada/LiveViews.swift
@@ -178,6 +178,7 @@ struct LivePhone: View {
HomeTitle()
ListenBar()
PillSwitch(selection: $page, options: [(.subtitles, "字幕"), (.notes, notesTitle)])
+ TranslateDownCard()
if let id = room.sessionID { FixAskCard(fixes: model.fixes, session: id) }
}
.padding(.horizontal, 16)
@@ -192,6 +193,7 @@ struct LivePhone: View {
.background(Ink.ground)
.overlay(alignment: .bottom) { FixToast(fixes: model.fixes).padding(.horizontal, 16).padding(.bottom, 8) }
.animation(.snappy(duration: 0.2), value: model.fixes.toast)
+ .animation(.snappy(duration: 0.2), value: model.translationDown)
.onChange(of: model.livePage) { page = model.livePage }
}
@@ -202,6 +204,33 @@ struct LivePhone: View {
enum LivePage: String { case subtitles, notes }
+/// 连不上翻译: why the subtitles are only the original. Without a key, the key is the fix (Ling
+/// needs no proxy in mainland China), so the card opens 设置; with one, it comes back by itself.
+struct TranslateDownCard: View {
+ @EnvironmentObject var model: AppModel
+
+ var body: some View {
+ if model.translationDown {
+ Button { if !model.ling.hasKey { model.tab = .settings; model.showSettings = true } } label: {
+ HStack(alignment: .top, spacing: 10) {
+ Image(systemName: "exclamationmark.triangle.fill").foregroundStyle(Ink.accent).padding(.top, 2)
+ VStack(alignment: .leading, spacing: 3) {
+ Text("连不上翻译,新字幕暂时只有原文").font(.subheadline.weight(.semibold)).foregroundStyle(Ink.ink)
+ Text(model.ling.hasKey ? L("网络连不上,连上后会自动继续") : L("填 Ling key 后不用代理也能翻译,还会整理出纪要。"))
+ .font(.footnote).foregroundStyle(Ink.secondary).fixedSize(horizontal: false, vertical: true)
+ }
+ Spacer(minLength: 0)
+ if !model.ling.hasKey { Image(systemName: "chevron.right").font(.footnote.weight(.semibold)).foregroundStyle(Ink.tertiary).padding(.top, 3) }
+ }
+ .padding(14)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .background(Color.white, in: RoundedRectangle(cornerRadius: 18, style: .continuous))
+ }
+ .buttonStyle(.plain)
+ }
+ }
+}
+
/// The lines so far as white cards, the one being said outlined in the accent; follows the newest.
struct LiveLines: View {
@EnvironmentObject var model: AppModel
@@ -266,6 +295,7 @@ struct LivePad: View {
var body: some View {
VStack(spacing: 0) {
+ TranslateDownCard().frame(maxWidth: 560).padding(.horizontal, 20).padding(.top, 18)
if let id = room.sessionID {
FixAskCard(fixes: model.fixes, session: id).frame(maxWidth: 560).padding(.horizontal, 20).padding(.top, 18)
}