diff options
author | Marc Stibane <marc@taler.net> | 2023-11-06 20:10:09 +0100 |
---|---|---|
committer | Marc Stibane <marc@taler.net> | 2023-11-06 20:10:09 +0100 |
commit | 63fa5d3c0d2db7bd39a2c0220745c962282dffed (patch) | |
tree | 12527d2e776ec5f958340d46b747e2862f194bde | |
parent | a26ecb96bacc36952265bc40fd532e1535cdb427 (diff) | |
download | taler-ios-63fa5d3c0d2db7bd39a2c0220745c962282dffed.tar.gz taler-ios-63fa5d3c0d2db7bd39a2c0220745c962282dffed.tar.bz2 taler-ios-63fa5d3c0d2db7bd39a2c0220745c962282dffed.zip |
L10N, EMPTYSTRING
-rw-r--r-- | TalerWallet1/Controllers/PublicConstants.swift | 1 | ||||
-rw-r--r-- | TalerWallet1/Helper/LocalizedAlertError.swift | 3 | ||||
-rw-r--r-- | TalerWallet1/Helper/TalerDater.swift | 6 | ||||
-rw-r--r-- | TalerWallet1/Views/Exchange/QuiteSomeCoins.swift | 4 | ||||
-rw-r--r-- | TalerWallet1/Views/HelperViews/CopyShare.swift | 6 | ||||
-rw-r--r-- | TalerWallet1/Views/HelperViews/SelectDays.swift | 7 | ||||
-rw-r--r-- | TalerWallet1/Views/Peer2peer/PaymentPurpose.swift | 3 | ||||
-rw-r--r-- | TalerWallet1/Views/Peer2peer/SendPurpose.swift | 4 |
8 files changed, 16 insertions, 18 deletions
diff --git a/TalerWallet1/Controllers/PublicConstants.swift b/TalerWallet1/Controllers/PublicConstants.swift index 3b778bd..ddcd126 100644 --- a/TalerWallet1/Controllers/PublicConstants.swift +++ b/TalerWallet1/Controllers/PublicConstants.swift @@ -13,6 +13,7 @@ public let ONEDAY: UInt = 1 // 1..3 public let SEVENDAYS: UInt = 7 // 3..9 public let THIRTYDAYS: UInt = 30 // 10..30 +public let EMPTYSTRING = "" // avoid automatic translation of empty "" textLiterals in Text() public let HTTPS = "https://" //public let DEMOBANK = HTTPS + "bAnK.dEmO.tAlEr.nEt" // should be weird to read, but still work //public let DEMOEXCHANGE = HTTPS + "eXcHaNgE.dEmO.tAlEr.nEt" diff --git a/TalerWallet1/Helper/LocalizedAlertError.swift b/TalerWallet1/Helper/LocalizedAlertError.swift index ff6dfc1..513f93d 100644 --- a/TalerWallet1/Helper/LocalizedAlertError.swift +++ b/TalerWallet1/Helper/LocalizedAlertError.swift @@ -48,8 +48,7 @@ extension View { error.wrappedValue = nil } } message: { error in - let emptyStr = "" - Text(error.failureReason ?? error.recoverySuggestion ?? emptyStr) + Text(error.failureReason ?? error.recoverySuggestion ?? EMPTYSTRING) } } } diff --git a/TalerWallet1/Helper/TalerDater.swift b/TalerWallet1/Helper/TalerDater.swift index 5bde4bc..427e0f9 100644 --- a/TalerWallet1/Helper/TalerDater.swift +++ b/TalerWallet1/Helper/TalerDater.swift @@ -65,7 +65,7 @@ public class TalerDater: DateFormatter { do { let milliseconds = try from.milliseconds() let date = Date(milliseconds: milliseconds) -// let date = date(from: from) + if relative { let now = Date.now let timeInterval = now.timeIntervalSince(date) @@ -75,8 +75,8 @@ public class TalerDater: DateFormatter { } return (shared.string(from: date), date) } catch { // Never -// let never = LocalizedString("Never") - return ("Never", nil) + let never = String(localized: "No date", comment: "Timestamp missing or invalid") + return (never, nil) } } diff --git a/TalerWallet1/Views/Exchange/QuiteSomeCoins.swift b/TalerWallet1/Views/Exchange/QuiteSomeCoins.swift index 961d9d6..f1e5589 100644 --- a/TalerWallet1/Views/Exchange/QuiteSomeCoins.swift +++ b/TalerWallet1/Views/Exchange/QuiteSomeCoins.swift @@ -57,8 +57,8 @@ struct QuiteSomeCoins: View { if !someCoins.invalid { if !someCoins.tooMany { if someCoins.manyCoins { - Text(someCoins.quiteSome ? "Warning: It will take quite some time to withdraw this amount!" - : "Warning: It will take some time to withdraw this amount.") + Text(someCoins.quiteSome ? "Note: It will take quite some time to withdraw this amount! Be more patient..." + : "Note: It will take some time to withdraw this amount. Be patient...") .foregroundColor(someCoins.quiteSome ? .red : .primary) .accessibilityFont(.body) .multilineTextAlignment(.leading) diff --git a/TalerWallet1/Views/HelperViews/CopyShare.swift b/TalerWallet1/Views/HelperViews/CopyShare.swift index 078244a..500759b 100644 --- a/TalerWallet1/Views/HelperViews/CopyShare.swift +++ b/TalerWallet1/Views/HelperViews/CopyShare.swift @@ -22,15 +22,17 @@ struct CopyButton: View { Button(action: copyAction) { if vertical { VStack { + let shortCopy = String(localized: "Copy.short", defaultValue: "Copy", comment: "5 letters max, else abbreviate") Image(systemName: "doc.on.doc") .accessibility(hidden: true) - Text("Copy", comment: "5 letters max, else abbreviate") + Text(shortCopy) } } else { + let longCopy = String(localized: "Copy.long", defaultValue: "Copy", comment: "may be a bit longer") HStack { Image(systemName: "doc.on.doc") .accessibility(hidden: true) - Text("Copy", comment: "may be a bit longer") + Text(longCopy) } } } diff --git a/TalerWallet1/Views/HelperViews/SelectDays.swift b/TalerWallet1/Views/HelperViews/SelectDays.swift index 5c3c998..081f924 100644 --- a/TalerWallet1/Views/HelperViews/SelectDays.swift +++ b/TalerWallet1/Views/HelperViews/SelectDays.swift @@ -35,7 +35,6 @@ struct SelectDays: View { var body: some View { let selectedStr = String(localized: "selected", comment: "VoiceOver hint which button is selected") - let emptyStr = "" Section { // (alignment: .leading) Text("Expires in:") @@ -51,7 +50,7 @@ struct SelectDays: View { Text("\(ONEDAY) Day", comment: "1 Day, might get plural (e.g. 2..3 Days), 4 letters max., abbreviate if longer") // TODO: Plural } }.buttonStyle(TalerButtonStyle(type: (selected == ONEDAY) ? .prominent : .bordered, dimmed: true)) - .accessibilityValue((selected == ONEDAY) ? selectedStr : emptyStr) + .accessibilityValue((selected == ONEDAY) ? selectedStr : EMPTYSTRING) .disabled(!isEnabled) Button(action: sevenDayAction) { @@ -61,7 +60,7 @@ struct SelectDays: View { Text("\(SEVENDAYS) Days", comment: "7 Days, always plural (3..9), 4 letters max., abbreviate if longer") } }.buttonStyle(TalerButtonStyle(type: (selected == SEVENDAYS) ? .prominent : .bordered, dimmed: true)) - .accessibilityValue((selected == SEVENDAYS) ? selectedStr : emptyStr) + .accessibilityValue((selected == SEVENDAYS) ? selectedStr : EMPTYSTRING) .disabled(!isEnabled || maxExpiration < SEVENDAYS) Button(action: thirtyDayAction) { @@ -71,7 +70,7 @@ struct SelectDays: View { Text("\(THIRTYDAYS) Days", comment: "30 Days, always plural (10..30), 4 letters max., abbreviate if longer") } }.buttonStyle(TalerButtonStyle(type: (selected == THIRTYDAYS) ? .prominent : .bordered, dimmed: true)) - .accessibilityValue((selected == THIRTYDAYS) ? selectedStr : emptyStr) + .accessibilityValue((selected == THIRTYDAYS) ? selectedStr : EMPTYSTRING) .disabled(!isEnabled || maxExpiration < THIRTYDAYS) } // 3 buttons } diff --git a/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift b/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift index 373daa8..8b04c12 100644 --- a/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift +++ b/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift @@ -61,7 +61,6 @@ struct PaymentPurpose: View { .disabled(false) .padding(.bottom) - let emptyStr = "" let disabled = (expireDays == 0) || (summary.count < 1) NavigationLink(destination: LazyView { SendDoneV(stack: stack.push(), @@ -76,7 +75,7 @@ struct PaymentPurpose: View { } .buttonStyle(TalerButtonStyle(type: .prominent)) .disabled(disabled) - .accessibilityHint(disabled ? "enabled when subject and expiration are set" : emptyStr) + .accessibilityHint(disabled ? "enabled when subject and expiration are set" : EMPTYSTRING) Spacer() } diff --git a/TalerWallet1/Views/Peer2peer/SendPurpose.swift b/TalerWallet1/Views/Peer2peer/SendPurpose.swift index e84e3df..06ba0a4 100644 --- a/TalerWallet1/Views/Peer2peer/SendPurpose.swift +++ b/TalerWallet1/Views/Peer2peer/SendPurpose.swift @@ -81,7 +81,6 @@ struct SendPurpose: View { .disabled(false) .padding(.bottom) - let emptyStr = "" let disabled = (expireDays == 0) || (summary.count < 1) // TODO: check amountAvailable NavigationLink(destination: LazyView { SendDoneV(stack: stack.push(), @@ -95,8 +94,7 @@ struct SendPurpose: View { } .buttonStyle(TalerButtonStyle(type: .prominent)) .disabled(disabled) - .accessibilityHint(disabled ? "enabled when subject and expiration are set" : emptyStr) - + .accessibilityHint(disabled ? "enabled when subject and expiration are set" : EMPTYSTRING) Spacer() } |