commit e2dd55954a12e4785b2543ae545f7a9b60c99933
parent 30ee1978d8eb3777cdeb38cdbb5282e9ddd52879
Author: Marc Stibane <marc@taler.net>
Date: Sun, 19 Jul 2026 15:20:29 +0200
descI18n
Diffstat:
3 files changed, 6 insertions(+), 21 deletions(-)
diff --git a/TalerWallet1/Model/Model+Payment.swift b/TalerWallet1/Model/Model+Payment.swift
@@ -154,10 +154,10 @@ struct ContractChoice: Codable, Hashable {
case inputs, outputs
}
- func description(_ preferredLanguageCodes: [String]) -> String? {
+ var descI18n: String? {
if let i18nDict = self.descriptionI18n {
if !i18nDict.isEmpty {
- for code in preferredLanguageCodes {
+ for code in Locale.preferredLanguageCodes {
if let descI18n = i18nDict[code] {
return descI18n
}
diff --git a/TalerWallet1/Views/Sheets/Payment/ChoicesView.swift b/TalerWallet1/Views/Sheets/Payment/ChoicesView.swift
@@ -30,21 +30,6 @@ struct ChoicesView: View, Sendable {
.foregroundColor(Color.clear)
}
}
- func description(_ contractChoice: ContractChoice) -> String? {
- if let i18nDict = contractChoice.descriptionI18n {
- if !i18nDict.isEmpty {
- for code in Locale.preferredLanguageCodes {
- if let descI18n = i18nDict[code] {
- return descI18n
- }
- }
- }
- }
- if let desc = contractChoice.description {
- return desc
- }
- return nil
- }
var body: some View {
ForEach(choiceTriple, id: \.1) { choice in
@@ -86,7 +71,7 @@ struct ChoicesView: View, Sendable {
}
} header: {
if showHeader {
- if let description = description(contractChoice) {
+ if let description = contractChoice.descI18n {
Text(description)
} } }
}
diff --git a/TalerWallet1/Views/Transactions/TransactionPayDetailV.swift b/TalerWallet1/Views/Transactions/TransactionPayDetailV.swift
@@ -1,5 +1,5 @@
/*
- * This file is part of GNU Taler, ©2022-25 Taler Systems S.A.
+ * This file is part of GNU Taler, ©2022-26 Taler Systems S.A.
* See LICENSE.md
*/
/**
@@ -82,8 +82,8 @@ struct TransactionPayDetailV: View {
if let choices = contractTerms.choices,
choices.indices.contains(choiceIndex) {
let choice = choices[choiceIndex]
-// Text(choice.text)
-
+ Text(choice.descI18n ?? "Index: \(choiceIndex)") // should never happen
+ .talerFont(.body)
}
}
}