taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 162ebba56d84ca2c01d3add213d86842872432f0
parent f6cd2c9bf128b6fb59da106668f3a230b63abdbd
Author: Marc Stibane <marc@taler.net>
Date:   Mon,  8 Jun 2026 18:07:45 +0200

Use i18n

Diffstat:
MTalerWallet1/Views/Sheets/Payment/ChoicesView.swift | 18+++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/TalerWallet1/Views/Sheets/Payment/ChoicesView.swift b/TalerWallet1/Views/Sheets/Payment/ChoicesView.swift @@ -30,6 +30,21 @@ 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 String(localized: "No description", comment: "contractChoice.description") + } var body: some View { ForEach(choiceTriple, id: \.1) { choice in @@ -37,8 +52,9 @@ struct ChoicesView: View, Sendable { let contractChoice: ContractChoice = choice.1 let index: Int = choice.2 let isPaymentPossible = selectionDetail.status == .paymentPossible + // Only show items with human readable description let scopeInfo = selectionDetail.scopeInfo - if let description = contractChoice.description { + if let description = description(contractChoice) { Section(header: Text(description)) { let amountV = HStack { Spacer()