Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions Sources/CodexBar/PreferencesSpendDashboardPane.swift
Original file line number Diff line number Diff line change
Expand Up @@ -418,28 +418,20 @@ private struct SpendCurrencySection: View {
Text(self.group.currencyCode)
.font(.headline)
Spacer()
Text(self.group.totalCost.map {
UsageFormatter.currencyString($0, currencyCode: self.group.currencyCode)
} ?? L("Spend unavailable"))
Text(spendDashboardGroupCostText(self.group))
.font(.title3.weight(.semibold))
.monospacedDigit()
}

Text(
"\(L("Local estimated history")) · " +
spendDashboardCoverageText(
covered: self.group.coveredDayCount,
requested: self.requestedDays))
Text(spendDashboardHistoryCaption(self.group, requestedDays: self.requestedDays))
.font(.caption)
.foregroundStyle(.secondary)

SpendDashboardPanel {
HStack(spacing: 24) {
SpendSummaryValue(
title: L("Estimated spend"),
value: self.group.totalCost.map {
UsageFormatter.currencyString($0, currencyCode: self.group.currencyCode)
} ?? "—")
value: self.group.totalCost == nil ? "—" : spendDashboardGroupCostText(self.group))
SpendSummaryValue(
title: L("Tracked tokens"),
value: self.group.totalTokens.map(UsageFormatter.tokenCountString) ?? "—")
Expand Down Expand Up @@ -530,7 +522,7 @@ private struct SpendModelPanel: View {
.padding(.vertical, 10)
case .partial, .complete:
if presentation == .partial {
Label(L("Model breakdown unavailable"), systemImage: "exclamationmark.triangle")
Label(L("Partial model breakdown"), systemImage: "exclamationmark.triangle")
.font(.caption)
.foregroundStyle(.secondary)
.padding(.bottom, 6)
Expand Down Expand Up @@ -772,3 +764,28 @@ private struct SpendDashboardPanel<Content: View>: View {
}
}
}

func spendDashboardGroupCostText(_ group: SpendDashboardModel.CurrencyGroup) -> String {
guard let cost = group.totalCost else { return L("Spend unavailable") }
let formatted = UsageFormatter.currencyString(cost, currencyCode: group.currencyCode)
return group.hasPartialCost ? "~\(formatted)" : formatted
}

func spendDashboardPartialSubscriptionsText(_ group: SpendDashboardModel.CurrencyGroup) -> String {
L("%d of %d subscriptions have spend", group.pricedProviderCount, group.providers.count)
}

func spendDashboardHistoryCaption(
_ group: SpendDashboardModel.CurrencyGroup,
requestedDays: Int) -> String
{
var parts: [String] = []
if group.hasPartialCost {
parts.append(L("Partial estimate"))
parts.append(spendDashboardPartialSubscriptionsText(group))
} else {
parts.append(L("Local estimated history"))
}
parts.append(spendDashboardCoverageText(covered: group.coveredDayCount, requested: requestedDays))
return parts.joined(separator: " · ")
}
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/ar.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "تبقى العملات الأصلية منفصلة؛ تستبعد صفوف حساب Codex سجل جلسات Pi.";
"Spend unavailable" = "الإنفاق غير متاح";
"Model breakdown unavailable" = "تفصيل الإنفاق حسب النموذج غير متاح";
"Partial estimate" = "تقدير جزئي";
"Partial model breakdown" = "تفاصيل النماذج الجزئية";
"%d of %d subscriptions have spend" = "%d من %d اشتراكات لديها إنفاق";
"Local estimated history" = "السجل التقديري المحلي";
"Coverage" = "التغطية";
"Estimated spend" = "الإنفاق التقديري";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/ca.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Les monedes originals es mantenen separades; les files de comptes de Codex exclouen l’historial de sessions de Pi.";
"Spend unavailable" = "Despesa no disponible";
"Model breakdown unavailable" = "Desglossament per model no disponible";
"Partial estimate" = "Estimació parcial";
"Partial model breakdown" = "Desglossament de models parcial";
"%d of %d subscriptions have spend" = "%d de %d subscripcions tenen despesa";
"Local estimated history" = "Historial local estimat";
"Coverage" = "Cobertura";
"Estimated spend" = "Despesa estimada";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Originalwährungen bleiben getrennt; Codex-Kontozeilen schließen den Pi-Sitzungsverlauf aus.";
"Spend unavailable" = "Ausgaben nicht verfügbar";
"Model breakdown unavailable" = "Modellaufschlüsselung nicht verfügbar";
"Partial estimate" = "Teilschätzung";
"Partial model breakdown" = "Unvollständige Modellaufschlüsselung";
"%d of %d subscriptions have spend" = "%d von %d Abonnements haben Ausgaben";
"Local estimated history" = "Lokaler Schätzverlauf";
"Coverage" = "Abdeckung";
"Estimated spend" = "Geschätzte Ausgaben";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Native currencies stay separate; Codex account rows exclude Pi session history.";
"Spend unavailable" = "Spend unavailable";
"Model breakdown unavailable" = "Model breakdown unavailable";
"Partial estimate" = "Partial estimate";
"Partial model breakdown" = "Partial model breakdown";
"%d of %d subscriptions have spend" = "%d of %d subscriptions have spend";
"Local estimated history" = "Local estimated history";
"Coverage" = "Coverage";
"Estimated spend" = "Estimated spend";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Las divisas originales se mantienen separadas; las filas de cuentas de Codex excluyen el historial de sesiones de Pi.";
"Spend unavailable" = "Gasto no disponible";
"Model breakdown unavailable" = "Desglose por modelo no disponible";
"Partial estimate" = "Estimación parcial";
"Partial model breakdown" = "Desglose de modelos parcial";
"%d of %d subscriptions have spend" = "%d de %d suscripciones tienen gasto";
"Local estimated history" = "Historial local estimado";
"Coverage" = "Cobertura";
"Estimated spend" = "Gasto estimado";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/fa.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "ارزهای اصلی جدا نگه داشته می‌شوند؛ ردیف‌های حساب Codex تاریخچه نشست‌های Pi را دربر نمی‌گیرند.";
"Spend unavailable" = "هزینه در دسترس نیست";
"Model breakdown unavailable" = "تفکیک مدل در دسترس نیست";
"Partial estimate" = "برآورد جزئی";
"Partial model breakdown" = "جزئیات ناقص مدلها";
"%d of %d subscriptions have spend" = "%d از %d اشتراک دارای هزینه هستند";
"Local estimated history" = "تاریخچه برآورد محلی";
"Coverage" = "پوشش";
"Estimated spend" = "برآورد هزینه";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Les devises d’origine restent séparées ; les lignes de compte Codex excluent l’historique des sessions Pi.";
"Spend unavailable" = "Dépenses indisponibles";
"Model breakdown unavailable" = "Répartition par modèle indisponible";
"Partial estimate" = "Estimation partielle";
"Partial model breakdown" = "Répartition des modèles partielle";
"%d of %d subscriptions have spend" = "%d abonnements sur %d ont des dépenses";
"Local estimated history" = "Historique local estimé";
"Coverage" = "Couverture";
"Estimated spend" = "Dépenses estimées";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/gl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "As moedas orixinais mantéñense separadas; as filas das contas de Codex exclúen o historial de sesións de Pi.";
"Spend unavailable" = "Gasto non dispoñible";
"Model breakdown unavailable" = "Desglose por modelo non dispoñible";
"Partial estimate" = "Estimación parcial";
"Partial model breakdown" = "Desagregación de modelos parcial";
"%d of %d subscriptions have spend" = "%d de %d subscricións teñen gasto";
"Local estimated history" = "Historial local estimado";
"Coverage" = "Cobertura";
"Estimated spend" = "Gasto estimado";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/id.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Mata uang asli tetap dipisahkan; baris akun Codex tidak menyertakan riwayat sesi Pi.";
"Spend unavailable" = "Data pengeluaran tidak tersedia";
"Model breakdown unavailable" = "Rincian per model tidak tersedia";
"Partial estimate" = "Perkiraan sebagian";
"Partial model breakdown" = "Rincian model sebagian";
"%d of %d subscriptions have spend" = "%d dari %d langganan memiliki pengeluaran";
"Local estimated history" = "Riwayat perkiraan lokal";
"Coverage" = "Cakupan";
"Estimated spend" = "Perkiraan pengeluaran";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Le valute originali rimangono separate; le righe degli account Codex escludono la cronologia delle sessioni Pi.";
"Spend unavailable" = "Spesa non disponibile";
"Model breakdown unavailable" = "Ripartizione per modello non disponibile";
"Partial estimate" = "Stima parziale";
"Partial model breakdown" = "Dettaglio modelli parziale";
"%d of %d subscriptions have spend" = "%d di %d abbonamenti hanno spese";
"Local estimated history" = "Cronologia locale stimata";
"Coverage" = "Copertura";
"Estimated spend" = "Spesa stimata";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "各通貨は別々に扱われ、Codex アカウント行には Pi セッション履歴を含めません。";
"Spend unavailable" = "支出を取得できません";
"Model breakdown unavailable" = "モデル別の内訳を取得できません";
"Partial estimate" = "部分的な見積もり";
"Partial model breakdown" = "部分的なモデル内訳";
"%d of %d subscriptions have spend" = "%d / %d 件のサブスクリプションに支出データがあります";
"Local estimated history" = "ローカル推定履歴";
"Coverage" = "対象範囲";
"Estimated spend" = "推定支出";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/ko.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "각 통화는 별도로 유지되며 Codex 계정 행에서는 Pi 세션 기록이 제외됩니다.";
"Spend unavailable" = "지출 정보 없음";
"Model breakdown unavailable" = "모델별 내역을 사용할 수 없습니다";
"Partial estimate" = "부분 추정치";
"Partial model breakdown" = "부분 모델 내역";
"%d of %d subscriptions have spend" = "%d / %d개 구독에 지출 데이터가 있습니다";
"Local estimated history" = "로컬 예상 내역";
"Coverage" = "포함 범위";
"Estimated spend" = "예상 지출";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/nl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Oorspronkelijke valuta’s blijven gescheiden; rijen met Codex-accounts sluiten Pi-sessiegeschiedenis uit.";
"Spend unavailable" = "Uitgaven niet beschikbaar";
"Model breakdown unavailable" = "Uitsplitsing per model niet beschikbaar";
"Partial estimate" = "Gedeeltelijke schatting";
"Partial model breakdown" = "Gedeeltelijke modeluitsplitsing";
"%d of %d subscriptions have spend" = "%d van %d abonnementen hebben uitgaven";
"Local estimated history" = "Lokaal geschatte geschiedenis";
"Coverage" = "Dekking";
"Estimated spend" = "Geschatte uitgaven";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/pl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Waluty źródłowe pozostają rozdzielone; wiersze kont Codex nie obejmują historii sesji Pi.";
"Spend unavailable" = "Wydatki niedostępne";
"Model breakdown unavailable" = "Podział według modeli jest niedostępny";
"Partial estimate" = "Szacunek częściowy";
"Partial model breakdown" = "Częściowe zestawienie modeli";
"%d of %d subscriptions have spend" = "%d z %d subskrypcji ma wydatki";
"Local estimated history" = "Lokalna historia szacunkowa";
"Coverage" = "Pokrycie";
"Estimated spend" = "Szacowane wydatki";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/pt-BR.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "As moedas originais permanecem separadas; as linhas de contas do Codex excluem o histórico de sessões do Pi.";
"Spend unavailable" = "Gastos indisponíveis";
"Model breakdown unavailable" = "Detalhamento por modelo indisponível";
"Partial estimate" = "Estimativa parcial";
"Partial model breakdown" = "Detalhamento parcial de modelos";
"%d of %d subscriptions have spend" = "%d de %d assinaturas têm gastos";
"Local estimated history" = "Histórico local estimado";
"Coverage" = "Cobertura";
"Estimated spend" = "Gastos estimados";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Исходные валюты остаются раздельными; строки учётных записей Codex не включают историю сеансов Pi.";
"Spend unavailable" = "Расходы недоступны";
"Model breakdown unavailable" = "Разбивка по моделям недоступна";
"Partial estimate" = "Частичная оценка";
"Partial model breakdown" = "Частичная разбивка по моделям";
"%d of %d subscriptions have spend" = "У %d из %d подписок есть данные о расходах";
"Local estimated history" = "Локальная история оценок";
"Coverage" = "Охват";
"Estimated spend" = "Предполагаемые расходы";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/sv.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Ursprungliga valutor hålls åtskilda; rader för Codex-konton utesluter Pi-sessionshistorik.";
"Spend unavailable" = "Utgifter ej tillgängliga";
"Model breakdown unavailable" = "Modellfördelning ej tillgänglig";
"Partial estimate" = "Delvis uppskattning";
"Partial model breakdown" = "Delvis modellfördelning";
"%d of %d subscriptions have spend" = "%d av %d prenumerationer har utgifter";
"Local estimated history" = "Lokal uppskattad historik";
"Coverage" = "Täckning";
"Estimated spend" = "Uppskattade utgifter";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/th.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "สกุลเงินต้นทางแยกจากกัน แถวบัญชี Codex ไม่รวมประวัติเซสชัน Pi";
"Spend unavailable" = "ไม่มีข้อมูลค่าใช้จ่าย";
"Model breakdown unavailable" = "ไม่มีรายละเอียดแยกตามโมเดล";
"Partial estimate" = "ประมาณการบางส่วน";
"Partial model breakdown" = "รายละเอียดโมเดลบางส่วน";
"%d of %d subscriptions have spend" = "%d จาก %d การสมัครมีข้อมูลการใช้จ่าย";
"Local estimated history" = "ประวัติโดยประมาณในเครื่อง";
"Coverage" = "ความครอบคลุม";
"Estimated spend" = "ค่าใช้จ่ายโดยประมาณ";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/tr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Kaynak para birimleri ayrı tutulur; Codex hesap satırlarına Pi oturum geçmişi dahil edilmez.";
"Spend unavailable" = "Harcama verisi kullanılamıyor";
"Model breakdown unavailable" = "Model dökümü kullanılamıyor";
"Partial estimate" = "Kısmi tahmin";
"Partial model breakdown" = "Kısmi model dökümü";
"%d of %d subscriptions have spend" = "%d / %d abonelikte harcama var";
"Local estimated history" = "Yerel tahmini geçmiş";
"Coverage" = "Kapsam";
"Estimated spend" = "Tahmini harcama";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/uk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Вихідні валюти залишаються розділеними; рядки облікових записів Codex не включають історію сеансів Pi.";
"Spend unavailable" = "Витрати недоступні";
"Model breakdown unavailable" = "Розподіл за моделями недоступний";
"Partial estimate" = "Часткова оцінка";
"Partial model breakdown" = "Часткова розбивка за моделями";
"%d of %d subscriptions have spend" = "У %d з %d підписок є дані про витрати";
"Local estimated history" = "Локальна історія оцінок";
"Coverage" = "Охоплення";
"Estimated spend" = "Орієнтовні витрати";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/vi.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "Đơn vị tiền tệ gốc được giữ riêng biệt; các hàng tài khoản Codex không bao gồm lịch sử phiên Pi.";
"Spend unavailable" = "Không có dữ liệu chi tiêu";
"Model breakdown unavailable" = "Phân tích theo mô hình không khả dụng";
"Partial estimate" = "Ước tính một phần";
"Partial model breakdown" = "Phân tách mô hình một phần";
"%d of %d subscriptions have spend" = "%d / %d gói đăng ký có chi tiêu";
"Local estimated history" = "Lịch sử ước tính cục bộ";
"Coverage" = "Phạm vi";
"Estimated spend" = "Chi tiêu ước tính";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "各原始币种保持分开;Codex 帐户行不包含 Pi 会话历史。";
"Spend unavailable" = "支出数据不可用";
"Model breakdown unavailable" = "模型明细不可用";
"Partial estimate" = "部分估算";
"Partial model breakdown" = "部分模型明细";
"%d of %d subscriptions have spend" = "%d / %d 个订阅有支出数据";
"Local estimated history" = "本地估算历史";
"Coverage" = "覆盖范围";
"Estimated spend" = "估算支出";
Expand Down
3 changes: 3 additions & 0 deletions Sources/CodexBar/Resources/zh-Hant.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,9 @@
"Native currencies stay separate; Codex account rows exclude Pi session history." = "各原始幣別保持分開;Codex 帳號列不包含 Pi 工作階段歷史。";
"Spend unavailable" = "無法取得支出資料";
"Model breakdown unavailable" = "無法取得模型明細";
"Partial estimate" = "部分估算";
"Partial model breakdown" = "部分模型明細";
"%d of %d subscriptions have spend" = "%d / %d 個訂閱有支出資料";
"Local estimated history" = "本機預估歷史";
"Coverage" = "涵蓋範圍";
"Estimated spend" = "預估支出";
Expand Down
Loading