taler-ios

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

commit 8e8e76e74ec2b38eb18f3abc0e25e6bc3b0be0cf
parent 8120f9e0b2f57a40670bda34f3d0df5098db6d29
Author: Marc Stibane <marc@taler.net>
Date:   Sat, 18 Jul 2026 11:07:28 +0200

descriptionI18n

Diffstat:
MTalerWallet1/Model/Model+Payment.swift | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/TalerWallet1/Model/Model+Payment.swift b/TalerWallet1/Model/Model+Payment.swift @@ -153,6 +153,22 @@ struct ContractChoice: Codable, Hashable { case descriptionI18n = "description_i18n" case inputs, outputs } + + func description(_ preferredLanguageCodes: [String]) -> String? { + if let i18nDict = self.descriptionI18n { + if !i18nDict.isEmpty { + for code in preferredLanguageCodes { + if let descI18n = i18nDict[code] { + return descI18n + } + } + } + } + if let desc = self.description { + return desc + } + return nil + } } struct MerchantContractTerms: Codable {