Localize all app copy via Localizable.strings
This commit is contained in:
@@ -272,12 +272,12 @@ struct SettingsView: View {
|
||||
}
|
||||
|
||||
private func inRangeText(_ status: DebugLocationStatus) -> String {
|
||||
guard status.coordinate != nil else { return "waiting for fix" }
|
||||
guard status.coordinate != nil else { return NSLocalizedString("waiting for fix", comment: "") }
|
||||
let fuelName = status.fuel.displayName.lowercased()
|
||||
if status.inRangeCount == 1 {
|
||||
return "1 \(fuelName) station within \(distanceUnit.format(status.radiusKM))"
|
||||
return String(format: NSLocalizedString("1 %@ station within %@", comment: ""), fuelName, distanceUnit.format(status.radiusKM))
|
||||
}
|
||||
return "\(status.inRangeCount) \(fuelName) stations within \(distanceUnit.format(status.radiusKM))"
|
||||
return String(format: NSLocalizedString("%lld %@ stations within %@", comment: ""), status.inRangeCount, fuelName, distanceUnit.format(status.radiusKM))
|
||||
}
|
||||
|
||||
private func cheapestText(_ station: FuelStation, fuel: FuelType, distance: Double?) -> String {
|
||||
@@ -289,9 +289,9 @@ struct SettingsView: View {
|
||||
}
|
||||
|
||||
private func ageText(_ age: TimeInterval) -> String {
|
||||
if age < 60 { return "\(Int(age))s ago" }
|
||||
if age < 3600 { return "\(Int(age / 60))m \(Int(age.truncatingRemainder(dividingBy: 60)))s ago" }
|
||||
return "\(Int(age / 3600))h \(Int((age.truncatingRemainder(dividingBy: 3600)) / 60))m ago"
|
||||
if age < 60 { return String(format: NSLocalizedString("%llds ago", comment: ""), Int(age)) }
|
||||
if age < 3600 { return String(format: NSLocalizedString("%lldm %llds ago", comment: ""), Int(age / 60), Int(age.truncatingRemainder(dividingBy: 60))) }
|
||||
return String(format: NSLocalizedString("%lldh %lldm ago", comment: ""), Int(age / 3600), Int((age.truncatingRemainder(dividingBy: 3600)) / 60))
|
||||
}
|
||||
|
||||
private var appVersion: String {
|
||||
@@ -358,7 +358,7 @@ struct SettingsView: View {
|
||||
case .authorized, .provisional, .ephemeral:
|
||||
onTestAlert()
|
||||
case .denied:
|
||||
testAlertMessage = "Notifications are turned off for FuelBoard. Enable them in Settings → Notifications → FuelBoard, then try again."
|
||||
testAlertMessage = NSLocalizedString("Notifications are turned off for FuelBoard. Enable them in Settings → Notifications → FuelBoard, then try again.", comment: "")
|
||||
default:
|
||||
// First time — ask, then fire if granted.
|
||||
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, _ in
|
||||
@@ -366,7 +366,7 @@ struct SettingsView: View {
|
||||
if granted {
|
||||
onTestAlert()
|
||||
} else {
|
||||
testAlertMessage = "Notifications weren't allowed, so no test alert was sent."
|
||||
testAlertMessage = NSLocalizedString("Notifications weren't allowed, so no test alert was sent.", comment: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,7 +412,7 @@ final class TipStore: ObservableObject {
|
||||
// Connect yet), still allow the attempt so the user sees a clear
|
||||
// outcome rather than a dead button.
|
||||
guard let product else {
|
||||
message = "The tip isn't available in this build yet — check back after an App Store release."
|
||||
message = NSLocalizedString("The tip isn't available in this build yet — check back after an App Store release.", comment: "")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -422,19 +422,19 @@ final class TipStore: ObservableObject {
|
||||
case .success(let verification):
|
||||
switch verification {
|
||||
case .verified:
|
||||
message = "Thank you! Your tip has been received. ⛽"
|
||||
message = NSLocalizedString("Thank you! Your tip has been received. ⛽", comment: "")
|
||||
case .unverified:
|
||||
message = "The purchase couldn't be verified. Please try again."
|
||||
message = NSLocalizedString("The purchase couldn't be verified. Please try again.", comment: "")
|
||||
}
|
||||
case .userCancelled:
|
||||
message = nil // silent — the user just closed the sheet
|
||||
case .pending:
|
||||
message = "Your tip is pending approval. It'll finish automatically."
|
||||
message = NSLocalizedString("Your tip is pending approval. It'll finish automatically.", comment: "")
|
||||
@unknown default:
|
||||
message = nil
|
||||
}
|
||||
} catch {
|
||||
message = "The tip couldn't be completed: \(error.localizedDescription)"
|
||||
message = String(format: NSLocalizedString("The tip couldn't be completed: %@", comment: ""), error.localizedDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user