taler-ios

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

BankDialects.swift (2191B)


      1 /*
      2  * This file is part of GNU Taler, ©2022-25 Taler Systems S.A.
      3  * See LICENSE.md
      4  */
      5 /**
      6  * @author Marc Stibane
      7  */
      8 import Foundation
      9 
     10 enum BankDialectString {
     11     case deleteExchange     // button title
     12     case warningText1       // first warning, simple
     13     case warningText2       // second warning
     14     case warningText3       // consequence for 2nd, with currency name
     15 }
     16 
     17 func localizedString(_ key: BankDialectString, forDialect: BankDialect?, _ option: String = "") -> String {
     18     if forDialect == .gls {
     19         switch key {
     20             case .deleteExchange:
     21                 return String(localized: "GLS.Exchange.Delete.Button",
     22                            defaultValue: "Terminate contract", comment: "button title")
     23 
     24             case .warningText1:
     25                 return String(localized: "GLS.Exchange.Delete.Warning1",
     26                            defaultValue: "Are you sure you want to terminate this contract?")
     27 
     28             case .warningText2:
     29                 return String(localized: "GLS.Exchange.Delete.Warning2",
     30                            defaultValue: "You still have digital money in your wallet. Terminate anyway?")
     31 
     32             case .warningText3:
     33                 return String(localized: "GLS.Exchange.Delete.Warning3",
     34                            defaultValue: "You will lose all \(option) of this contract.", comment: "Currency")
     35         }
     36     }
     37     // more dialects here... 
     38     switch key {
     39         case .deleteExchange:
     40             return String(localized: "Exchange.Delete.Button",
     41                        defaultValue: "Delete payment service", comment: "button title")
     42 
     43         case .warningText1:
     44             return String(localized: "Exchange.Delete.Warning1",
     45                        defaultValue: "Are you sure you want to delete this payment service?")
     46 
     47         case .warningText2:
     48             return String(localized: "Exchange.Delete.Warning2",
     49                        defaultValue: "This payment service is in use. Delete anyway?")
     50 
     51         case .warningText3:
     52             return String(localized: "Exchange.Delete.Warning3",
     53                        defaultValue: "You will lose all \(option) of this payment service.", comment: "Currency")
     54     }
     55 }