From b5965faa1a737cdec2c7096cc9225e9c46c5a7ef Mon Sep 17 00:00:00 2001 From: Marc Stibane Date: Wed, 24 Apr 2024 14:18:08 +0200 Subject: More localizations --- TalerWallet1/Controllers/DebugViewC.swift | 2 +- TalerWallet1/Views/Balances/BalanceRowView.swift | 2 +- .../Views/Balances/BalancesSectionView.swift | 4 +-- TalerWallet1/Views/Banking/DepositAmountV.swift | 2 +- TalerWallet1/Views/Banking/DepositIbanV.swift | 2 +- TalerWallet1/Views/Banking/QuiteSomeCoins.swift | 8 +++--- TalerWallet1/Views/HelperViews/ListStyle.swift | 2 +- .../Views/HelperViews/QRCodeDetailView.swift | 30 +++++++++++++--------- TalerWallet1/Views/Main/WalletEmptyView.swift | 2 +- TalerWallet1/Views/Peer2peer/P2PSubjectV.swift | 4 +-- TalerWallet1/Views/Settings/AboutView.swift | 6 ++--- .../Views/Sheets/Payment/PaymentView.swift | 2 +- .../Views/Transactions/TransactionDetailV.swift | 4 +-- .../Views/Transactions/TransactionRowView.swift | 8 +++--- .../Views/Transactions/TransactionSummaryV.swift | 4 +-- .../Views/Transactions/TransactionsListView.swift | 2 +- 16 files changed, 45 insertions(+), 39 deletions(-) diff --git a/TalerWallet1/Controllers/DebugViewC.swift b/TalerWallet1/Controllers/DebugViewC.swift index c7de32f..bdf8e55 100644 --- a/TalerWallet1/Controllers/DebugViewC.swift +++ b/TalerWallet1/Controllers/DebugViewC.swift @@ -137,7 +137,7 @@ struct DebugViewV: View { .id("viewID") .accessibilityLabel(Text("View.ID.", comment: "AccessibilityLabel")) .accessibilityValue(viewIDString) - .accessibilityHint("Shows which view you currently are on.") + .accessibilityHint(String(localized: "Shows which view you currently are on.")) Spacer() } .edgesIgnoringSafeArea(.top) diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift b/TalerWallet1/Views/Balances/BalanceRowView.swift index e39e48a..0861011 100644 --- a/TalerWallet1/Views/Balances/BalanceRowView.swift +++ b/TalerWallet1/Views/Balances/BalanceRowView.swift @@ -48,7 +48,7 @@ struct BalanceCell: View { NavigationLink { balanceDest } label: { balanceCell .accessibilityElement(children: .combine) - .accessibilityHint("Will go to main transactions list.") + .accessibilityHint(String(localized: "Will go to main transactions list.")) // .accessibilityLabel(balanceTitleStr + " " + amountStr) // TODO: CurrencyFormatter! } } diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift index 1fab4db..7643b32 100644 --- a/TalerWallet1/Views/Balances/BalancesSectionView.swift +++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift @@ -111,7 +111,7 @@ extension BalancesSectionView: View { UIApplication.shared.open(URL(string:DEMOSHOP)!, options: [:]) } .buttonStyle(TalerButtonStyle(type: .bordered, narrow: false, aligned: .center)) - .accessibilityHint("Will go to the demo shop website.") + .accessibilityHint(String(localized: "Will go to the demo shop website.")) .listRowSeparator(.hidden) } DepositWithdrawV(stack: stack.push(), @@ -217,7 +217,7 @@ fileprivate struct BalancesPendingRowView: View { needsKYC ? needsKYCStr : shouldConfirm ? needsConfStr : EMPTYSTRING) - .accessibilityHint("Will go to Pending transactions.") + .accessibilityHint(String(localized: "Will go to Pending transactions.")) } // NavLinkLabel } // body } // BalancesPendingRowView diff --git a/TalerWallet1/Views/Banking/DepositAmountV.swift b/TalerWallet1/Views/Banking/DepositAmountV.swift index a03ee2b..0884295 100644 --- a/TalerWallet1/Views/Banking/DepositAmountV.swift +++ b/TalerWallet1/Views/Banking/DepositAmountV.swift @@ -134,7 +134,7 @@ struct DepositAmountV: View { } .buttonStyle(TalerButtonStyle(type: .prominent, disabled: disabled || depositStarted)) .disabled(disabled || depositStarted) - .accessibilityHint(disabled ? "enabled when amount is non-zero, but not higher than your available amount" : EMPTYSTRING) + .accessibilityHint(disabled ? String(localized: "enabled when amount is non-zero, but not higher than your available amount") : EMPTYSTRING) }.padding(.horizontal) } // ScrollVStack .frame(maxWidth: .infinity, alignment: .leading) // .scrollBounceBehavior(.basedOnSize) needs iOS 16.4 diff --git a/TalerWallet1/Views/Banking/DepositIbanV.swift b/TalerWallet1/Views/Banking/DepositIbanV.swift index 6d588bf..15da601 100644 --- a/TalerWallet1/Views/Banking/DepositIbanV.swift +++ b/TalerWallet1/Views/Banking/DepositIbanV.swift @@ -114,7 +114,7 @@ struct DepositIbanV: View { } .buttonStyle(TalerButtonStyle(type: .prominent, disabled: disabled)) .disabled(disabled) - .accessibilityHint(disabled ? "enabled when account holder and IBAN are set" : EMPTYSTRING) + .accessibilityHint(disabled ? String(localized: "enabled when account holder and IBAN are set") : EMPTYSTRING) }.padding(.horizontal) } // ScrollVStack // .scrollBounceBehavior(.basedOnSize) needs iOS 16.4 .navigationTitle(subjectTitle(amountToTransfer, currencyInfo)) diff --git a/TalerWallet1/Views/Banking/QuiteSomeCoins.swift b/TalerWallet1/Views/Banking/QuiteSomeCoins.swift index 4bcfb88..0a090fd 100644 --- a/TalerWallet1/Views/Banking/QuiteSomeCoins.swift +++ b/TalerWallet1/Views/Banking/QuiteSomeCoins.swift @@ -17,10 +17,10 @@ struct SomeCoins { let fee: Amount? func feeLabel(_ currencyInfo: CurrencyInfo?) -> String { return if let fee { - invalid ? "Amount too small!" - : tooMany ? "Amount too big for a single withdrawal!" - : fee.isZero ? "No withdrawal fee" - : "- \(fee.string(currencyInfo)) fee" + invalid ? String(localized: "Amount too small!") + : tooMany ? String(localized: "Amount too big for a single withdrawal!") + : fee.isZero ? String(localized: "No withdrawal fee") + : String(localized: "- \(fee.string(currencyInfo)) fee") } else { EMPTYSTRING } diff --git a/TalerWallet1/Views/HelperViews/ListStyle.swift b/TalerWallet1/Views/HelperViews/ListStyle.swift index c3f625a..6d5a0f1 100644 --- a/TalerWallet1/Views/HelperViews/ListStyle.swift +++ b/TalerWallet1/Views/HelperViews/ListStyle.swift @@ -66,7 +66,7 @@ struct AnyViewDemo: View { var body: some View { VStack { - Picker("List Style", selection: $selectedStyle) { + Picker("List Style:", selection: $selectedStyle) { ForEach(MyListStyle.allCases, id: \.self) { Text($0.displayName.capitalized).tag($0) } diff --git a/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift b/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift index 52cdbba..44796f2 100644 --- a/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift +++ b/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift @@ -25,13 +25,15 @@ struct QRCodeDetailView: View { var body: some View { if talerURI.count > 10 { Section { - let eitherMini = incoming ? String(localized: "Either (payer)", defaultValue: "Either", + let eitherMini = incoming ? String(localized: "Either (payer) Mini 1", + defaultValue: "Either", comment: "Either (copy/share this link to the payer)") - : String(localized: "Either (payee)", defaultValue: "Either", + : String(localized: "Either (payee) Mini 1", + defaultValue: "Either", comment: "Either (copy/share this link to the payee)") - let eitherLong = incoming ? String(localized: "Either provide this payment link (payer)", + let eitherLong = incoming ? String(localized: "Either (payer) Long 1", defaultValue: "Either provide this payment link") - : String(localized: "Either provide this payment link (payee)", + : String(localized: "Either (payee) Long 1", defaultValue: "Either provide this payment link") Text(minimalistic ? eitherMini : eitherLong) .multilineTextAlignment(.leading) @@ -43,10 +45,10 @@ struct QRCodeDetailView: View { // .padding(.bottom) .listRowSeparator(.hidden) - let otherPartyMini = incoming ? String(localized: "or scan this(payer)", defaultValue: "or scan this") - : String(localized: "or scan this(payee)", defaultValue: "or scan this") - let otherPartyLong = incoming ? String(localized: "to the payer, or") - : String(localized: "to the payee, or") + let otherPartyMini = incoming ? String(localized: "Either (payer) Mini 2", defaultValue: "or scan this") + : String(localized: "Either (payee) Mini 2", defaultValue: "or scan this") + let otherPartyLong = incoming ? String(localized: "Either (payer) Long 2", defaultValue: "to the payer, or") + : String(localized: "Either (payee) Long 2", defaultValue: "to the payee, or") Text(minimalistic ? otherPartyMini : otherPartyLong) .multilineTextAlignment(.leading) .talerFont(.title3) @@ -56,11 +58,15 @@ struct QRCodeDetailView: View { .accessibilityLabel("QR Code") .listRowSeparator(.hidden) - let scanMini = incoming ? String(localized: "to pay \(amountStr).", comment: "e.g. '5,3 €'") - : String(localized: "to receive \(amountStr).", comment: "e.g. '$ 7.41'") - let scanLong = incoming ? String(localized: "let the payer scan this QR code to pay \(amountStr).", + let scanMini = incoming ? String(localized: "Either (payer) Mini 3", + defaultValue: "to pay \(amountStr).", comment: "e.g. '5,3 €'") + : String(localized: "Either (payee) Mini 3", + defaultValue: "to receive \(amountStr).", comment: "e.g. '$ 7.41'") + let scanLong = incoming ? String(localized: "Either (payer) Long 3", + defaultValue: "let the payer scan this QR code to pay \(amountStr).", comment: "e.g. '5,3 €'") - : String(localized: "let the payee scan this QR code to receive \(amountStr).", + : String(localized: "Either (payee) Long 3", + defaultValue: "let the payee scan this QR code to receive \(amountStr).", comment: "e.g. '$ 7.41'") Text(minimalistic ? scanMini : scanLong) .multilineTextAlignment(.leading) diff --git a/TalerWallet1/Views/Main/WalletEmptyView.swift b/TalerWallet1/Views/Main/WalletEmptyView.swift index 46cb387..15ff639 100644 --- a/TalerWallet1/Views/Main/WalletEmptyView.swift +++ b/TalerWallet1/Views/Main/WalletEmptyView.swift @@ -53,7 +53,7 @@ struct WalletEmptyView: View { // Link(title, destination: URL(string: DEMOBANK)!) // .buttonStyle(TalerButtonStyle(type: .prominent, narrow: false, aligned: .center)) // .padding(.vertical) -// .accessibilityHint("Will go to the demo bank website.") +// .accessibilityHint(String(localized: "Will go to the demo bank website.")) } } .listStyle(myListStyle.style).anyView diff --git a/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift b/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift index bbb2587..1e1550e 100644 --- a/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift +++ b/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift @@ -100,7 +100,7 @@ struct P2PSubjectV: View { Text(verbatim: "\(summary.count)/100") // maximum 100 characters .frame(maxWidth: .infinity, alignment: .trailing) .talerFont(.body) - .accessibilityValue("\(summary.count) characters of 100") + .accessibilityValue(String(localized: "\(summary.count) characters of 100")) // TODO: compute max Expiration day from peerPushCheck to disable 30 (and even 7) SelectDays(selected: $expireDays, maxExpiration: THIRTYDAYS) @@ -120,7 +120,7 @@ struct P2PSubjectV: View { } .buttonStyle(TalerButtonStyle(type: .prominent, disabled: disabled)) .disabled(disabled) - .accessibilityHint(disabled ? "enabled when subject and expiration are set" : EMPTYSTRING) + .accessibilityHint(disabled ? String(localized: "enabled when subject and expiration are set") : EMPTYSTRING) }.padding(.horizontal) } // ScrollVStack // .scrollBounceBehavior(.basedOnSize) needs iOS 16.4 .navigationTitle(subjectTitle(amountToTransfer, currencyInfo)) diff --git a/TalerWallet1/Views/Settings/AboutView.swift b/TalerWallet1/Views/Settings/AboutView.swift index dc0569e..2a4965a 100644 --- a/TalerWallet1/Views/Settings/AboutView.swift +++ b/TalerWallet1/Views/Settings/AboutView.swift @@ -40,7 +40,7 @@ struct AboutView: View { .frame(maxWidth: .infinity, alignment: .center) // .accessibilityLabel("Progress indicator") .onTapGesture(count: 1) { rotationEnabled.toggle() } - SettingsItem(name: "Visit the taler.net website", id1: "web", + SettingsItem(name: String(localized: "Visit the taler.net website"), id1: "web", description: minimalistic ? nil : String(localized: "More info about GNU Taler in general...")) { } .accessibilityAddTraits(.isLink) .accessibilityRemoveTraits(.isStaticText) @@ -48,7 +48,7 @@ struct AboutView: View { UIApplication.shared.open(URL(string:TALER_NET)!, options: [:]) } - SettingsItem(name: "App Version", id1: "app") { + SettingsItem(name: String(localized: "App Version"), id1: "app") { Text(verbatim: "\(Bundle.main.releaseVersionNumberPretty)") } Group { @@ -62,7 +62,7 @@ struct AboutView: View { } } } else { - SettingsItem(name: "Wallet-Core Version", id1: "wallet-coreV") { + SettingsItem(name: String(localized: "WalletCore Version"), id1: "wallet-coreV") { Text(verbatim: "\(walletCore.versionInfo?.implementationSemver ?? "unknown")") } } diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift index 7cd0ae3..dd3581f 100644 --- a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift +++ b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift @@ -55,7 +55,7 @@ struct PaymentView: View { merchant: terms.merchant.name) // TODO: payment: popup with all possible exchanges, check fees } else if let balanceDetails = preparePayResult.balanceDetails { // Insufficient - Text("You don't have enough \(currency)") + Text("You don't have enough \(currency).") .talerFont(.headline) ThreeAmountsV(stack: stack.push(), topTitle: topTitle, diff --git a/TalerWallet1/Views/Transactions/TransactionDetailV.swift b/TalerWallet1/Views/Transactions/TransactionDetailV.swift index 0e4feb0..e374a12 100644 --- a/TalerWallet1/Views/Transactions/TransactionDetailV.swift +++ b/TalerWallet1/Views/Transactions/TransactionDetailV.swift @@ -25,10 +25,10 @@ struct TransactionDetailV: View { if let fulfillmentUrl = info.fulfillmentUrl { if let destination = URL(string: fulfillmentUrl) { - let buttonTitle = info.fulfillmentMessage ?? "Open merchant website" + let buttonTitle = info.fulfillmentMessage ?? String(localized: "Open merchant website") Link(buttonTitle, destination: destination) .buttonStyle(TalerButtonStyle(type: .bordered)) - .accessibilityHint("Will go to the merchant website.") + .accessibilityHint(String(localized: "Will go to the merchant website.")) } } else if let fulfillmentMessage = info.fulfillmentMessage { Text(fulfillmentMessage) diff --git a/TalerWallet1/Views/Transactions/TransactionRowView.swift b/TalerWallet1/Views/Transactions/TransactionRowView.swift index dea1331..61e878d 100644 --- a/TalerWallet1/Views/Transactions/TransactionRowView.swift +++ b/TalerWallet1/Views/Transactions/TransactionRowView.swift @@ -90,7 +90,7 @@ struct TransactionRowView: View { .talerFont(.headline) // .fontWeight(.medium) iOS 16 .padding(.bottom, -2.0) - .accessibilityLabel(doneOrPending ? topString : topString + ", canceled") + .accessibilityLabel(doneOrPending ? topString : topString + String(localized: ", canceled")) let centerBottom = Text(dateString) .foregroundColor(textColor) .talerFont(.callout) @@ -193,9 +193,9 @@ struct TransactionRowView: View { } else { layout4 } // view for iOS 15 } .accessibilityElement(children: .combine) - .accessibilityValue(needsKYC ? ". Needs K Y C" : - shouldConfirm ? ". Needs bank confirmation" : EMPTYSTRING) - .accessibilityHint("Will go to detail view.") + .accessibilityValue(needsKYC ? String(localized: ". Needs K Y C") : + shouldConfirm ? String(localized: ". Needs bank confirmation") : EMPTYSTRING) + .accessibilityHint(String(localized: "Will go to detail view.")) } } // MARK: - diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift index 4f089c4..12f6314 100644 --- a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift +++ b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift @@ -214,7 +214,7 @@ struct TransactionSummaryV: View { } Link("Open KYC website", destination: destination) .buttonStyle(TalerButtonStyle(type: .prominent, badge: NEEDS_KYC)) - .accessibilityHint("Will go to KYC website to confirm this withdrawal.") + .accessibilityHint(String(localized: "Will go to KYC website to confirm this withdrawal.")) } } } @@ -233,7 +233,7 @@ struct TransactionSummaryV: View { } Link("Confirm now", destination: destination) .buttonStyle(TalerButtonStyle(type: .prominent, badge: CONFIRM_BANK)) - .accessibilityHint("Will go to bank website to confirm this withdrawal.") + .accessibilityHint(String(localized: "Will go to bank website to confirm this withdrawal.")) } } } diff --git a/TalerWallet1/Views/Transactions/TransactionsListView.swift b/TalerWallet1/Views/Transactions/TransactionsListView.swift index 3f2dbc9..a049e89 100644 --- a/TalerWallet1/Views/Transactions/TransactionsListView.swift +++ b/TalerWallet1/Views/Transactions/TransactionsListView.swift @@ -62,7 +62,7 @@ struct TransactionsListView: View { } } // ScrollView .navigationTitle(navTitle) - .accessibilityHint(Text("Transaction list")) + .accessibilityHint(String(localized: "Transaction list")) .task { symLog.log(".task ") await reloadAllAction(stack.push()) -- cgit v1.2.3