fix: count bridged people on the rendezvous cell caption (#1810)

The settings line already names the cell. It now adds a plural count when someone is across the bridge, and stays the cell line when nobody is.
This commit is contained in:
Taksh Kothari authored and GitHub committed 2026-11-27 09:39:58 -10:00
1 parent abf932acfd
commit e64e5be1e1
4 files changed
+942 -1

No files matched your search

+870
View File
@@ -29203,6 +29203,876 @@
}
}
},
"app_info.settings.bridge.cell_people" : {
"comment" : "Caption under the mesh bridge toggle: the rendezvous cell and a plural count of people across the bridge",
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "rendezvous cell: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d person across the bridge"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d people across the bridge"
}
}
}
}
}
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "rendezvous-zelle: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d person über die brücke"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d personen über die brücke"
}
}
}
}
}
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "celda de encuentro: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d persona al otro lado del puente"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d personas al otro lado del puente"
}
}
}
}
}
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "cellule de rendez-vous : %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d personne de l'autre côté du pont"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d personnes de l'autre côté du pont"
}
}
}
}
}
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "cella di incontro: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d persona oltre il ponte"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d persone oltre il ponte"
}
}
}
}
}
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
"value" : "célula de encontro: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d pessoa do outro lado da ponte"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d pessoas do outro lado da ponte"
}
}
}
}
}
}
},
"pt-BR" : {
"stringUnit" : {
"state" : "translated",
"value" : "célula de encontro: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d pessoa do outro lado da ponte"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d pessoas do outro lado da ponte"
}
}
}
}
}
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "ontmoetingscel: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d persoon aan de overkant"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d personen aan de overkant"
}
}
}
}
}
}
},
"sv" : {
"stringUnit" : {
"state" : "translated",
"value" : "mötescell: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d person på andra sidan"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d personer på andra sidan"
}
}
}
}
}
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"value" : "komórka spotkania: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d osoba po drugiej stronie"
}
},
"few" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d osoby po drugiej stronie"
}
},
"many" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d osób po drugiej stronie"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d osoby po drugiej stronie"
}
}
}
}
}
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "ячейка встречи: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d человек за мостом"
}
},
"few" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d человека за мостом"
}
},
"many" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d человек за мостом"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d человека за мостом"
}
}
}
}
}
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
"value" : "комірка зустрічі: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d людина по той бік мосту"
}
},
"few" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d людини по той бік мосту"
}
},
"many" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d людей по той бік мосту"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d людини по той бік мосту"
}
}
}
}
}
}
},
"ar" : {
"stringUnit" : {
"state" : "translated",
"value" : "خلية اللقاء: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"zero" : {
"stringUnit" : {
"state" : "translated",
"value" : "لا أحد عبر الجسر"
}
},
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "شخص واحد عبر الجسر"
}
},
"two" : {
"stringUnit" : {
"state" : "translated",
"value" : "شخصان عبر الجسر"
}
},
"few" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d أشخاص عبر الجسر"
}
},
"many" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d شخصًا عبر الجسر"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d شخص عبر الجسر"
}
}
}
}
}
}
},
"he" : {
"stringUnit" : {
"state" : "translated",
"value" : "תא מפגש: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "אדם אחד מעבר לגשר"
}
},
"two" : {
"stringUnit" : {
"state" : "translated",
"value" : "שני אנשים מעבר לגשר"
}
},
"many" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d אנשים מעבר לגשר"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d אנשים מעבר לגשר"
}
}
}
}
}
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "ランデブーセル: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "橋の向こうに%d人"
}
}
}
}
}
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "会合单元:%1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "桥对面有 %d 人"
}
}
}
}
}
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "會合單元:%1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "橋對面有 %d 人"
}
}
}
}
}
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "랑데부 셀: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "다리 너머 %d명"
}
}
}
}
}
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
"value" : "buluşma hücresi: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "köprünün ötesinde %d kişi"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "köprünün ötesinde %d kişi"
}
}
}
}
}
}
},
"hi" : {
"stringUnit" : {
"state" : "translated",
"value" : "मिलन सेल: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "पुल के पार %d व्यक्ति"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "पुल के पार %d व्यक्ति"
}
}
}
}
}
}
},
"bn" : {
"stringUnit" : {
"state" : "translated",
"value" : "মিলনস্থল সেল: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "সেতুর ওপারে %d জন"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "সেতুর ওপারে %d জন"
}
}
}
}
}
}
},
"fa" : {
"stringUnit" : {
"state" : "translated",
"value" : "سلول ملاقات: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d نفر آن سوی پل"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d نفر آن سوی پل"
}
}
}
}
}
}
},
"id" : {
"stringUnit" : {
"state" : "translated",
"value" : "sel titik temu: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d orang di seberang jembatan"
}
}
}
}
}
}
},
"ms" : {
"stringUnit" : {
"state" : "translated",
"value" : "sel titik temu: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d orang di seberang jambatan"
}
}
}
}
}
}
},
"th" : {
"stringUnit" : {
"state" : "translated",
"value" : "เซลล์นัดพบ: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d คนอีกฝั่งของสะพาน"
}
}
}
}
}
}
},
"vi" : {
"stringUnit" : {
"state" : "translated",
"value" : "ô hẹn gặp: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d người bên kia cầu"
}
}
}
}
}
}
},
"fil" : {
"stringUnit" : {
"state" : "translated",
"value" : "sel ng tagpuan: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d tao sa kabilang dulo ng tulay"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%d tao sa kabilang dulo ng tulay"
}
}
}
}
}
}
},
"ne" : {
"stringUnit" : {
"state" : "translated",
"value" : "भेट हुने सेल: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "पुलपारि %d जना"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "पुलपारि %d जना"
}
}
}
}
}
}
},
"ta" : {
"stringUnit" : {
"state" : "translated",
"value" : "சந்திப்பு செல்: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "பாலத்தின் மறுபக்கம் %d பேர்"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "பாலத்தின் மறுபக்கம் %d பேர்"
}
}
}
}
}
}
},
"ur" : {
"stringUnit" : {
"state" : "translated",
"value" : "ملاقات سیل: %1$@ · %2$#@people@"
},
"substitutions" : {
"people" : {
"argNum" : 2,
"formatSpecifier" : "lld",
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "پل کے پار %d فرد"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "پل کے پار %d افراد"
}
}
}
}
}
}
}
}
},
"app_info.settings.bridge.no_cell" : {
"extractionState" : "manual",
"localizations" : {
+33 -1
View File
@@ -86,6 +86,21 @@ struct AppInfoView: View {
cell
)
}
/// The cell caption plus how many people are across the bridge.
/// The count is a plural substitution, so "1 person" and "2 people"
/// are separate translations.
static func bridgeCell(_ cell: String, people: Int) -> String {
String(
format: String(
localized: "app_info.settings.bridge.cell_people",
defaultValue: "rendezvous cell: %1$@ · %2$#@people@",
comment: "Caption under the mesh bridge toggle: the rendezvous cell and a plural count of people across the bridge"
),
locale: .current,
cell,
people
)
}
static let bridgeNoCell = String(localized: "app_info.settings.bridge.no_cell", defaultValue: "no rendezvous cell yet — needs location access or a nearby bridge peer", comment: "Caption under the mesh bridge toggle when the bridge is on but has no geohash cell to meet on")
// Moved from LocationChannelsSheet; keys unchanged. (The former
@@ -439,7 +454,7 @@ struct AppInfoView: View {
// a hint about why there isn't one yet (no location and no
// bridge peer advertising a cell).
if bridgeService.isEnabled {
Text(bridgeService.activeCell.map(Strings.Settings.bridgeCell) ?? Strings.Settings.bridgeNoCell)
Text(bridgeCaption)
.bitchatFont(size: 11)
.foregroundColor(secondaryTextColor)
}
@@ -600,6 +615,23 @@ struct AppInfoView: View {
}
}
/// The line under the mesh bridge toggle. A live cell keeps the existing
/// caption, and adds the bridged-people count only when someone is there.
private var bridgeCaption: String {
let people = bridgeService.bridgedPeerCount
switch BridgeSettingsCaption.resolve(
hasCell: bridgeService.activeCell != nil,
people: people
) {
case .noCell:
return Strings.Settings.bridgeNoCell
case .cell:
return Strings.Settings.bridgeCell(bridgeService.activeCell ?? "")
case .cellAndPeople:
return Strings.Settings.bridgeCell(bridgeService.activeCell ?? "", people: people)
}
}
private var bridgeToggleBinding: Binding<Bool> {
Binding(
get: { bridgeService.isEnabled },
+22
View File
@@ -0,0 +1,22 @@
//
// BridgeSettingsCaption.swift
// bitchat
//
// Which line sits under the mesh bridge toggle.
//
import Foundation
/// The caption under the mesh bridge toggle. The people count is added only
/// when the rendezvous cell is known and someone is across the bridge, so a
/// quiet cell keeps the cell line it already had.
enum BridgeSettingsCaption: Equatable {
case noCell
case cell
case cellAndPeople
static func resolve(hasCell: Bool, people: Int) -> BridgeSettingsCaption {
guard hasCell else { return .noCell }
return people > 0 ? .cellAndPeople : .cell
}
}
+17
View File
@@ -0,0 +1,17 @@
import Testing
@testable import bitchat
struct BridgeCaptionTests {
@Test func noCellKeepsTheEmptyCaption() {
#expect(BridgeSettingsCaption.resolve(hasCell: false, people: 4) == .noCell)
}
@Test func aCellWithNobodyOmitsTheCount() {
#expect(BridgeSettingsCaption.resolve(hasCell: true, people: 0) == .cell)
}
@Test func aCellWithPeopleIncludesTheCount() {
#expect(BridgeSettingsCaption.resolve(hasCell: true, people: 1) == .cellAndPeople)
#expect(BridgeSettingsCaption.resolve(hasCell: true, people: 12) == .cellAndPeople)
}
}