taler-ios

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

commit ca158ae7a3f2205ed1ed7ded241e07a6dc83a277
parent 10f6373f868ad25be573090bfa5c695099c25039
Author: Marc Stibane <marc@taler.net>
Date:   Fri, 24 May 2024 08:20:46 +0200

Localization hints

Diffstat:
MTalerWallet1/Controllers/DebugViewC.swift | 2+-
MTalerWallet1/Helper/LocalizedAlertError.swift | 2+-
MTalerWallet1/Views/Banking/ExchangeListView.swift | 4++--
MTalerWallet1/Views/HelperViews/LaunchAnimationView.swift | 3++-
MTalerWallet1/Views/Settings/AboutView.swift | 7+++----
MTalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift | 8++++----
MTalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift | 6+++---
MTalerWallet1/Views/Sheets/Sheet.swift | 2+-
MTalerWallet1/Views/Transactions/ManualDetailsV.swift | 18+++++++++---------
MTalerWallet1/Views/Transactions/TransactionRowView.swift | 2+-
MTalerWallet1/Views/Transactions/TransactionSummaryV.swift | 17++++++++---------
11 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/TalerWallet1/Controllers/DebugViewC.swift b/TalerWallet1/Controllers/DebugViewC.swift @@ -135,7 +135,7 @@ struct DebugViewV: View { .font(.system(size: 11)) // no talerFont .monospacedDigit() .id("viewID") - .accessibilityLabel(Text("View.ID.", comment: "AccessibilityLabel")) + .accessibilityLabel(Text("View.ID.", comment: "VoiceOver")) .accessibilityValue(viewIDString) .accessibilityHint(String(localized: "Shows which view you currently are on.")) Spacer() diff --git a/TalerWallet1/Helper/LocalizedAlertError.swift b/TalerWallet1/Helper/LocalizedAlertError.swift @@ -38,7 +38,7 @@ extension View { @ViewBuilder func errorAlert(error: Binding<Error?>, - buttonTitle: LocalizedStringKey = "xloc.generic.ok", + buttonTitle: LocalizedStringKey = "OK", action: (() -> Void)? = nil) -> some View { let localizedAlertError = LocalizedAlertError(error: error.wrappedValue) diff --git a/TalerWallet1/Views/Banking/ExchangeListView.swift b/TalerWallet1/Views/Banking/ExchangeListView.swift @@ -32,8 +32,8 @@ struct ExchangeListView: View { } var body: some View { - let accessibilityLabelStr = String(localized: "Add Payment Service", comment: "accessibilityLabel for the + button") - let plusButton = PlusButton(accessibilityLabelStr: accessibilityLabelStr) { + let a11yLabelStr = String(localized: "Add Payment Service", comment: "VoiceOver for the + button") + let plusButton = PlusButton(accessibilityLabelStr: a11yLabelStr) { showAlert = true } let addTitleStr = String(localized: "Add Payment Service", comment: "title of the addExchange alert") diff --git a/TalerWallet1/Views/HelperViews/LaunchAnimationView.swift b/TalerWallet1/Views/HelperViews/LaunchAnimationView.swift @@ -38,7 +38,8 @@ struct RotatingTaler: View { .scaledToFit() .frame(width: size, height: size) .rotationEffect(rotationDirection ? Angle(degrees: 0) : Angle(degrees: 900)) - .accessibilityLabel(progress ? "In progress" : "Taler Logo") // decorative logo - with button function + .accessibilityLabel(progress ? Text("In progress", comment: "VoiceOver") + : Text("Taler Logo", comment: "VoiceOver")) // decorative logo - with button function .onReceive(animationTimer) { timerValue in if rotationEnabled { withAnimation(.easeInOut(duration: 1.9)) { diff --git a/TalerWallet1/Views/Settings/AboutView.swift b/TalerWallet1/Views/Settings/AboutView.swift @@ -35,10 +35,9 @@ struct AboutView: View { let walletCore = WalletCore.shared Group { List { - RotatingTaler(size: 100, progress: false, - rotationEnabled: $rotationEnabled) - .frame(maxWidth: .infinity, alignment: .center) -// .accessibilityLabel("Progress indicator") + RotatingTaler(size: 100, progress: false, rotationEnabled: $rotationEnabled) + // has its own accessibilityLabel + .frame(maxWidth: .infinity, alignment: .center) .onTapGesture(count: 1) { rotationEnabled.toggle() } SettingsItem(name: String(localized: "Visit the taler.net website"), id1: "web", description: minimalistic ? nil : String(localized: "More info about GNU Taler in general...")) { } diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift @@ -11,7 +11,7 @@ import SymLog struct P2pPayURIView: View { private let symLog = SymLogV(0) let stack: CallStack - let navTitle = String(localized: "Pay P2P") + let navTitle = String(localized: "Pay P2P", comment: "Nav Title") // the scanned URL let url: URL @@ -46,11 +46,11 @@ struct P2pPayURIView: View { merchant: nil) let expiration = peerPullDebitResponse.contractTerms.purse_expiration let (dateString, date) = TalerDater.dateString(from: expiration) - let accessibilityDate = TalerDater.accessibilityDate(date) ?? dateString - let accessibilityLabel = String(localized: "Expires: \(accessibilityDate)") + let a11yDate = TalerDater.accessibilityDate(date) ?? dateString + let a11yLabel = String(localized: "Expires: \(a11yDate)", comment: "VoiceOver") Text("Expires: \(dateString)") .talerFont(.body) - .accessibilityLabel(accessibilityLabel) + .accessibilityLabel(a11yLabel) .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) } .listStyle(myListStyle.style).anyView diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift @@ -55,11 +55,11 @@ struct P2pReceiveURIView: View { merchant: nil) let expiration = peerPushCreditResponse.contractTerms.purse_expiration let (dateString, date) = TalerDater.dateString(from: expiration) - let accessibilityDate = TalerDater.accessibilityDate(date) ?? dateString - let accessibilityLabel = String(localized: "Expires: \(accessibilityDate)") + let a11yDate = TalerDater.accessibilityDate(date) ?? dateString + let a11yLabel = String(localized: "Expires: \(a11yDate)", comment: "VoiceOver") Text("Expires: \(dateString)") .talerFont(.body) - .accessibilityLabel(accessibilityLabel) + .accessibilityLabel(a11yLabel) .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) } .listStyle(myListStyle.style).anyView diff --git a/TalerWallet1/Views/Sheets/Sheet.swift b/TalerWallet1/Views/Sheets/Sheet.swift @@ -58,7 +58,7 @@ struct Sheet: View { .monospacedDigit() .edgesIgnoringSafeArea(.top) .id("sheetID") - .accessibilityLabel(Text("Sheet.ID.", comment: "AccessibilityLabel")) + .accessibilityLabel(Text("Sheet.ID.", comment: "VoiceOver")) .accessibilityValue(idString) } .onDisappear { diff --git a/TalerWallet1/Views/Transactions/ManualDetailsV.swift b/TalerWallet1/Views/Transactions/ManualDetailsV.swift @@ -216,10 +216,10 @@ struct ManualDetailsV: View { let cryptocode = HStack { Text(details.reservePub) .monospacedDigit() - .accessibilityLabel("Cryptocode") + .accessibilityLabel(Text("Cryptocode", comment: "VoiceOver")) .frame(maxWidth: .infinity, alignment: .leading) CopyButton(textToCopy: details.reservePub, vertical: true) - .accessibilityLabel("Copy the cryptocode") + .accessibilityLabel(Text("Copy the cryptocode", comment: "VoiceOver")) .disabled(false) } .padding(.leading) let payeeCode = HStack { @@ -231,9 +231,9 @@ struct ManualDetailsV: View { .padding(.leading) } .frame(maxWidth: .infinity, alignment: .leading) .accessibilityElement(children: .combine) - .accessibilityLabel("Payee") + .accessibilityLabel(Text("Payee", comment: "VoiceOver")) CopyButton(textToCopy: receiverStr, vertical: true) - .accessibilityLabel("Copy the payee") + .accessibilityLabel(Text("Copy the payee", comment: "VoiceOver")) .disabled(false) } .padding(.top, -8) let ibanCode = HStack { @@ -245,9 +245,9 @@ struct ManualDetailsV: View { .padding(.leading) } .frame(maxWidth: .infinity, alignment: .leading) .accessibilityElement(children: .combine) - .accessibilityLabel("IBAN of the payee") + .accessibilityLabel(Text("IBAN of the payee", comment: "VoiceOver")) CopyButton(textToCopy: iban ?? EMPTYSTRING, vertical: true) - .accessibilityLabel("Copy the IBAN") + .accessibilityLabel(Text("Copy the IBAN", comment: "VoiceOver")) .disabled(false) } .padding(.top, -8) let xTalerCode = HStack { @@ -259,9 +259,9 @@ struct ManualDetailsV: View { .padding(.leading) } .frame(maxWidth: .infinity, alignment: .leading) .accessibilityElement(children: .combine) - .accessibilityLabel("account of the payee") + .accessibilityLabel(Text("account of the payee", comment: "VoiceOver")) CopyButton(textToCopy: xTaler, vertical: true) - .accessibilityLabel("Copy the account") + .accessibilityLabel(Text("Copy the account", comment: "VoiceOver")) .disabled(false) } .padding(.top, -8) @@ -316,7 +316,7 @@ struct ManualDetailsV: View { // Spacer() ShareButton(textToShare: payto) .frame(maxWidth: .infinity, alignment: .center) - .accessibilityLabel("Share the PayTo URL") + .accessibilityLabel(Text("Share the PayTo URL", comment: "VoiceOver")) .disabled(false) // Spacer() } .listRowSeparator(.automatic) diff --git 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 + String(localized: ", canceled")) + .accessibilityLabel(doneOrPending ? topString : topString + String(localized: ", canceled", comment: "VoiceOver")) let centerBottom = Text(dateString) .foregroundColor(textColor) .talerFont(.callout) diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift @@ -100,7 +100,7 @@ struct TransactionSummaryV: View { let pending = transaction.isPending let locale = TalerDater.shared.locale let (dateString, date) = TalerDater.dateString(from: common.timestamp) - let accessibilityDate = TalerDater.accessibilityDate(date) ?? dateString + let a11yDate = TalerDater.accessibilityDate(date) ?? dateString let navTitle2 = transaction.isDone ? transaction.localizedTypePast : transaction.localizedType VStack { @@ -117,7 +117,7 @@ struct TransactionSummaryV: View { } // Suspend + Resume buttons Text(dateString) .talerFont(.body) - .accessibilityLabel(accessibilityDate) + .accessibilityLabel(a11yDate) .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) .listRowSeparator(.hidden) VStack(alignment: .trailing) { @@ -296,10 +296,9 @@ struct TransactionSummaryV: View { let title = EMPTYSTRING Text(title) .talerFont(.body) - RotatingTaler(size: 100, progress: true, - rotationEnabled: $rotationEnabled) + RotatingTaler(size: 100, progress: true, rotationEnabled: $rotationEnabled) .frame(maxWidth: .infinity, alignment: .center) -// .accessibilityLabel("Progress indicator") + // has its own accessibilityLabel case .withdrawal(let withdrawalTransaction): Group { let details = withdrawalTransaction.details if pending { @@ -373,7 +372,7 @@ struct TransactionSummaryV: View { let stackStr = error.stack ?? EMPTYSTRING let errorStr = error.hint + "\n" + stackStr CopyButton(textToCopy: errorStr, vertical: true) - .accessibilityLabel("Copy the error") + .accessibilityLabel(Text("Copy the error", comment: "VoiceOver")) .disabled(false) } } @@ -384,11 +383,11 @@ struct TransactionSummaryV: View { if !transaction.isDone { let expiration = details.info.expiration let (dateString, date) = TalerDater.dateString(from: expiration) - let accessibilityDate = TalerDater.accessibilityDate(date) ?? dateString - let accessibilityLabel = String(localized: "Expires: \(accessibilityDate)") + let a11yDate = TalerDater.accessibilityDate(date) ?? dateString + let a11yLabel = String(localized: "Expires: \(a11yDate)", comment: "VoiceOver") Text("Expires: \(dateString)") .talerFont(.body) - .accessibilityLabel(accessibilityLabel) + .accessibilityLabel(a11yLabel) .foregroundColor(WalletColors().secondary(colorScheme, colorSchemeContrast)) } // TODO: isSendCoins should show QR only while not yet expired - either set timer or wallet-core should do so and send a state-changed notification