[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 12/54: Localization
From: |
gnunet |
Subject: |
[taler-taler-ios] 12/54: Localization |
Date: |
Fri, 30 Jun 2023 22:33:44 +0200 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit 8abb8bda005475d2567ba8af2d1b9b1130d1ed80
Author: Marc Stibane <marc@taler.net>
AuthorDate: Tue Jun 20 09:22:40 2023 +0200
Localization
---
TalerWallet1/Backend/Transaction.swift | 15 +++++++++++++++
TalerWallet1/Views/Balances/BalanceRowView.swift | 14 ++++++++++----
TalerWallet1/Views/Exchange/ManualWithdraw.swift | 1 +
TalerWallet1/Views/Main/SideBarView.swift | 3 ++-
TalerWallet1/Views/Payment/PaymentAcceptView.swift | 5 +++--
TalerWallet1/Views/Peer2peer/RequestPayment.swift | 12 +++++++-----
TalerWallet1/Views/Peer2peer/SendAmount.swift | 6 ++++--
TalerWallet1/Views/Transactions/ThreeAmounts.swift | 2 +-
.../Views/Transactions/TransactionRowView.swift | 22 +++-------------------
9 files changed, 46 insertions(+), 34 deletions(-)
diff --git a/TalerWallet1/Backend/Transaction.swift
b/TalerWallet1/Backend/Transaction.swift
index b49d560..fc77b17 100644
--- a/TalerWallet1/Backend/Transaction.swift
+++ b/TalerWallet1/Backend/Transaction.swift
@@ -321,6 +321,21 @@ enum Transaction: Decodable, Hashable, Identifiable {
var id: String { common.transactionId }
+ var localizedType: String {
+ switch common.type {
+ case .withdrawal: return String(localized: "Withdrawal")
+ case .deposit: return String(localized: "Deposit")
+ case .payment: return String(localized: "Payment")
+ case .refund: return String(localized: "Refund")
+ case .refresh: return String(localized: "Refresh")
+ case .reward: return String(localized: "Reward")
+ case .peerPushDebit: return String(localized: "P2P Send")
+ case .scanPushCredit: return String(localized: "P2P Receive")
+ case .peerPullCredit: return String(localized: "P2P Invoice")
+ case .scanPullDebit: return String(localized: "P2P Payment")
+ }
+ }
+
static func == (lhs: Transaction, rhs: Transaction) -> Bool {
return lhs.id == rhs.id
}
diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift
b/TalerWallet1/Views/Balances/BalanceRowView.swift
index b46099c..84a6386 100644
--- a/TalerWallet1/Views/Balances/BalanceRowView.swift
+++ b/TalerWallet1/Views/Balances/BalanceRowView.swift
@@ -14,26 +14,32 @@ struct BalanceRowView: View {
let recvAction: () -> Void
let rowAction: () -> Void
var body: some View {
+ let currency = amount.currencyStr
HStack {
Button("Request\nPayment", action: recvAction)
.lineLimit(2)
.disabled(false)
.buttonStyle(TalerButtonStyle(type: .bordered, narrow: true,
aligned: .leading))
- Button("Send\nCoins", action: sendAction)
+ Button("Send\n\(currency)", action: sendAction)
.lineLimit(2)
.disabled(amount.isZero)
.buttonStyle(TalerButtonStyle(type: .bordered, narrow: true,
aligned: .leading))
Button(action: rowAction) {
- VStack(alignment: .trailing) {
- Text("Balance")
- .font(.footnote)
+ VStack(alignment: .trailing, spacing: 0) {
+ HStack(alignment: .firstTextBaseline, spacing: 0) {
+ Text("B")
+ .font(.title2)
+ Text("alance")
+ .font(.footnote).bold()
.accessibility(sortPriority: 2)
+ }
Text("\(amount.valueStr)") // TODO: CurrencyFormatter?
.font(.title)
.accessibility(sortPriority: 1)
}
} .disabled(false)
.buttonStyle(TalerButtonStyle(type: .plain, aligned:
.trailing))
+// .background(Color.yellow)
}
.fixedSize(horizontal: false, vertical: true) // should make all
buttons equal height - but doesn't
.accessibilityElement(children: .combine)
diff --git a/TalerWallet1/Views/Exchange/ManualWithdraw.swift
b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
index 752165d..68a37bc 100644
--- a/TalerWallet1/Views/Exchange/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
@@ -40,6 +40,7 @@ struct ManualWithdraw: View {
let _ = symLog.vlog() // just to get the # to compare it with
.onAppear & onDisappear
#endif
let currency = exchange.currency!
+ let navTitle = String(localized: "Withdraw \(currency)")
let currencyField = CurrencyField(value: $centsToTransfer, currency:
currency) // becomeFirstResponder
let agePicker = AgePicker(ageMenuList: $ageMenuList, selectedAge:
$selectedAge)
diff --git a/TalerWallet1/Views/Main/SideBarView.swift
b/TalerWallet1/Views/Main/SideBarView.swift
index b58e528..af47861 100644
--- a/TalerWallet1/Views/Main/SideBarView.swift
+++ b/TalerWallet1/Views/Main/SideBarView.swift
@@ -29,7 +29,8 @@ struct SideBarView: View {
HStack { // sideView left, clear dismiss target right
EqualIconWidthDomain {
VStack(spacing: 10) {
- Link("GNU Taler", destination:
URL(string:"https://taler.net")!)
+ let gnuTaler = String("GNU Taler") // this should NOT be
translated
+ Link(gnuTaler, destination:
URL(string:"https://taler.net")!)
.font(.largeTitle) //.bold() iOS 16
.padding(.top, 30)
Image("taler-logo-2023-red")
diff --git a/TalerWallet1/Views/Payment/PaymentAcceptView.swift
b/TalerWallet1/Views/Payment/PaymentAcceptView.swift
index fe30c78..1ff5352 100644
--- a/TalerWallet1/Views/Payment/PaymentAcceptView.swift
+++ b/TalerWallet1/Views/Payment/PaymentAcceptView.swift
@@ -20,10 +20,11 @@ struct PaymentAcceptView: View {
Group {
let raw = detailsForUri.amountRaw
let effective = detailsForUri.amountEffective
+ let currency = raw.currencyStr
let fee = try! Amount.diff(raw, effective) // TODO: different
currencies
- ThreeAmountsView(topTitle: "Amount to pay:",
+ ThreeAmountsView(topTitle: String(localized: "Amount to pay:"),
topAmount: raw, fee: fee,
- bottomTitle: "Coins to be spent:",
+ bottomTitle: String(localized: "\(currency) to be
spent:"),
bottomAmount: effective,
large: true, pending: false, incoming: false,
baseURL:
detailsForUri.contractTerms.exchanges.first?.url)
diff --git a/TalerWallet1/Views/Peer2peer/RequestPayment.swift
b/TalerWallet1/Views/Peer2peer/RequestPayment.swift
index abb0726..1b18aed 100644
--- a/TalerWallet1/Views/Peer2peer/RequestPayment.swift
+++ b/TalerWallet1/Views/Peer2peer/RequestPayment.swift
@@ -8,7 +8,6 @@ import SymLog
struct RequestPayment: View {
private let symLog = SymLogV()
- let navTitle = String(localized: "Request Payment")
var scopeInfo: ScopeInfo
@Binding var centsToTransfer: UInt64
@@ -22,10 +21,13 @@ struct RequestPayment: View {
let _ = Self._printChanges()
let _ = symLog.vlog() // just to get the # to compare it with
.onAppear & onDisappear
#endif
- let currencyField = CurrencyField(value: $centsToTransfer, currency:
scopeInfo.currency)
+ let currency = scopeInfo.currency
+ let navTitle = String(localized: "Request \(currency)")
+ let currencyField = CurrencyField(value: $centsToTransfer, currency:
currency)
VStack(alignment: .leading, spacing: 6) {
- CurrencyInputView(currencyField: currencyField, title: "Amount to
receive:")
+ CurrencyInputView(currencyField: currencyField,
+ title: String(localized: "Amount to receive:"))
HStack {
let disabled = centsToTransfer == 0
@@ -43,7 +45,7 @@ struct RequestPayment: View {
deactivateAction()
}
}) {
- Text("title2")
+ Text("Create invoice")
}
.buttonStyle(TalerButtonStyle(type: .prominent))
.disabled(disabled)
@@ -52,9 +54,9 @@ struct RequestPayment: View {
Spacer()
}
.frame(maxWidth: .infinity, alignment: .leading)
- .navigationTitle(navTitle)
.padding(.horizontal)
.background(WalletColors().backgroundColor.edgesIgnoringSafeArea(.all))
+ .navigationTitle(navTitle)
.onAppear { // make CurrencyField show the keyboard
DebugViewC.shared.setViewID(VIEW_INVOICE_P2P)
print("❗️Yikes \(navTitle) onAppear")
diff --git a/TalerWallet1/Views/Peer2peer/SendAmount.swift
b/TalerWallet1/Views/Peer2peer/SendAmount.swift
index fc39f8e..47cd64c 100644
--- a/TalerWallet1/Views/Peer2peer/SendAmount.swift
+++ b/TalerWallet1/Views/Peer2peer/SendAmount.swift
@@ -38,6 +38,7 @@ struct SendAmount: View {
let _ = symLog.vlog() // just to get the # to compare it with
.onAppear & onDisappear
#endif
let currency = amountAvailable.currencyStr
+ let navTitle = String(localized: "Send \(currency)")
let currencyField = CurrencyField(value: $centsToTransfer, currency:
currency)
let fee = fee(ppCheck: peerPushCheck)
@@ -45,7 +46,8 @@ struct SendAmount: View {
let available = amountAvailable.readableDescription
Text("Available: \(available)")
.font(.title3)
- CurrencyInputView(currencyField: currencyField, title: "Amount to
send:")
+ CurrencyInputView(currencyField: currencyField,
+ title: String(localized: "Amount to send:"))
Text("+ \(fee) payment fee")
.foregroundColor(.red)
@@ -67,7 +69,7 @@ struct SendAmount: View {
expireDays: $expireDays,
deactivateAction: {})
}) {
- Text(title2)
+ Text("To another wallet")
}
.buttonStyle(TalerButtonStyle(type: .prominent))
.disabled(disabled)
diff --git a/TalerWallet1/Views/Transactions/ThreeAmounts.swift
b/TalerWallet1/Views/Transactions/ThreeAmounts.swift
index 25e0231..661fcfe 100644
--- a/TalerWallet1/Views/Transactions/ThreeAmounts.swift
+++ b/TalerWallet1/Views/Transactions/ThreeAmounts.swift
@@ -64,7 +64,7 @@ struct ThreeAmountsView: View {
large: large)
if let baseURL {
VStack {
- Text(incoming ? "from Exchange" : "to Exchange")
+ Text(incoming ? "from Exchange:" : "to Exchange:")
.font(.title3)
Text(baseURL.trimURL())
.font(large ? .title : .title2)
diff --git a/TalerWallet1/Views/Transactions/TransactionRowView.swift
b/TalerWallet1/Views/Transactions/TransactionRowView.swift
index 98349c8..b6e9286 100644
--- a/TalerWallet1/Views/Transactions/TransactionRowView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionRowView.swift
@@ -38,30 +38,14 @@ struct TransactionRowView: View {
: done ? WalletColors().transactionColor(incoming)
: WalletColors().uncompletedColor
- HStack {
+ HStack(spacing: 6) {
Image(systemName: incoming ? "text.badge.plus" :
"text.badge.minus")
.foregroundColor(foreColor)
- .padding(.trailing)
.font(.largeTitle)
.accessibility(hidden: true)
- if transaction.isWithdrawal {
- TransactionRowCenter(centerTop: String(localized:
"Withdrawal"), centerBottom: dateString)
- } else if transaction.isPayment {
- TransactionRowCenter(centerTop: String(localized: "Payment"),
centerBottom: dateString)
- } else if transaction.isP2pOutgoing {
- TransactionRowCenter(centerTop: String(localized: "P2P Send"),
centerBottom: dateString)
- } else if transaction.isP2pIncoming {
- TransactionRowCenter(centerTop: String(localized: "P2P
Receive"), centerBottom: dateString)
- } else if transaction.isRefund {
- TransactionRowCenter(centerTop: String(localized: "Refund"),
centerBottom: dateString)
- } else if transaction.isRefresh {
- TransactionRowCenter(centerTop: String(localized: "Refresh"),
centerBottom: dateString)
- } else if keys.contains(EXCHANGEBASEURL) {
- if let baseURL = details[EXCHANGEBASEURL] {
- TransactionRowCenter(centerTop: baseURL.trimURL(),
centerBottom: dateString)
- }
- }
+ TransactionRowCenter(centerTop: transaction.localizedType,
+ centerBottom: dateString)
Spacer()
VStack(alignment: .trailing) {
let sign = incoming ? "+" : "-"
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 05/54: cleanup, back to Swift 5.8 (for now until Xcode 15 is usable), (continued)
- [taler-taler-ios] 05/54: cleanup, back to Swift 5.8 (for now until Xcode 15 is usable), gnunet, 2023/06/30
- [taler-taler-ios] 04/54: PopToRoot instead of dismiss sheet, gnunet, 2023/06/30
- [taler-taler-ios] 03/54: Cleaned up buttons, gnunet, 2023/06/30
- [taler-taler-ios] 11/54: Accessibility, gnunet, 2023/06/30
- [taler-taler-ios] 18/54: remove loaded, gnunet, 2023/06/30
- [taler-taler-ios] 09/54: Launch animation, SideBarView, gnunet, 2023/06/30
- [taler-taler-ios] 01/54: Big update after DD37, gnunet, 2023/06/30
- [taler-taler-ios] 13/54: Overhaul withdraw + p2p, gnunet, 2023/06/30
- [taler-taler-ios] 17/54: for debugging time-outs, gnunet, 2023/06/30
- [taler-taler-ios] 10/54: Reduce Logging, gnunet, 2023/06/30
- [taler-taler-ios] 12/54: Localization,
gnunet <=
- [taler-taler-ios] 08/54: Preparations for localization + accessability, gnunet, 2023/06/30
- [taler-taler-ios] 19/54: remove dismissFirst, gnunet, 2023/06/30
- [taler-taler-ios] 14/54: Made Model a Singleton, gnunet, 2023/06/30
- [taler-taler-ios] 40/54: TransactionType, gnunet, 2023/06/30
- [taler-taler-ios] 26/54: PeerPullDebit, gnunet, 2023/06/30
- [taler-taler-ios] 16/54: Dummy, gnunet, 2023/06/30
- [taler-taler-ios] 34/54: sizeCategory, task, gnunet, 2023/06/30
- [taler-taler-ios] 06/54: Notifications, gnunet, 2023/06/30
- [taler-taler-ios] 42/54: BalanceRow, gnunet, 2023/06/30
- [taler-taler-ios] 15/54: Suspend-Resume, gnunet, 2023/06/30