Fix localization keys merged from community pull requests

This commit is contained in:
Garth Vander Houwen 2025-05-20 21:16:12 -07:00
parent b0fddbabfc
commit a2c869ec06
8 changed files with 218 additions and 712 deletions

File diff suppressed because it is too large Load diff

View file

@ -37,17 +37,17 @@ enum ActivityType: Int, CaseIterable, Identifiable {
var fileNameString: String {
switch self {
case .walking:
return "walk".localized
return "Walking".localized.lowercased()
case .hiking:
return "hiking".localized
return "Hiking".localized.lowercased()
case .biking:
return "biking".localized
return "Biking".localized.lowercased()
case .driving:
return "driving".localized
return "Driving".localized.lowercased()
case .overlanding:
return "overlanding".localized
return "Overlanding".localized.lowercased()
case .skiing:
return "skiing".localized
return "Skiing".localized.lowercased()
}
}
}

View file

@ -123,7 +123,7 @@ extension String {
with: "$1 $2",
options: .regularExpression
)
return "Node " + spaced
return "Node".localized + " " + spaced
}
// Adds variation selectors to prefer the graphical form of emoji.

View file

@ -58,7 +58,7 @@ struct SignalStrengthIndicator: View {
}
}
.accessibilityElement(children: .ignore)
.accessibilityLabel(NSLocalizedString("signal_strength", comment: "VoiceOver label for signal strength indicator"))
.accessibilityLabel("Signal strength".localized)
.accessibilityValue(accessibilityDescription)
}

View file

@ -101,7 +101,7 @@ struct BatteryCompact: View {
.accessibilityLabel(NSLocalizedString("Battery Level", comment: "VoiceOver label for battery gauge"))
// Set appropriate value based on the battery state using a computed property
.accessibilityValue(batteryLevel.map { level in
if level > 100 {
if level > 100 {
// Plugged in - same as PWD visual indicator
return NSLocalizedString("device_plugged_in", comment: "VoiceOver value for plugged in device")
} else if level == 100 {
@ -109,7 +109,7 @@ struct BatteryCompact: View {
return NSLocalizedString("device_charging", comment: "VoiceOver value for charging device")
} else {
// Normal battery level
return String(format: NSLocalizedString("battery_level_percent", comment: "VoiceOver value for battery level"), Int(level))
return String(format: NSLocalizedString("Battery Level %", comment: "VoiceOver value for battery level"), Int(level))
}
} ?? "Unknown")
}

View file

@ -6,7 +6,7 @@ struct RequestPositionButton: View {
var body: some View {
Button(action: action) {
Image(systemName: "mappin.and.ellipse")
.accessibilityLabel(NSLocalizedString("request_position", comment: "VoiceOver label for request position button"))
.accessibilityLabel("Position Exchange Requested".localized)
.symbolRenderingMode(.hierarchical)
.imageScale(.large)
.foregroundColor(.accentColor)

View file

@ -6,8 +6,8 @@ struct TextMessageSize: View {
var body: some View {
ProgressView("\("Bytes".localized): \(totalBytes) / \(maxbytes)", value: Double(totalBytes), total: Double(maxbytes))
.accessibilityLabel(NSLocalizedString("message_size", comment: "VoiceOver label for message size"))
.accessibilityValue(String(format: NSLocalizedString("bytes_used", comment: "VoiceOver value for bytes used"), totalBytes, maxbytes))
.accessibilityLabel(NSLocalizedString("Message Size", comment: "VoiceOver label for message size"))
.accessibilityValue(String(format: NSLocalizedString("Bytes Used", comment: "VoiceOver value for bytes used"), totalBytes, maxbytes))
.frame(width: 130)
.padding(5)
.font(.subheadline)

View file

@ -20,7 +20,7 @@ struct NodeListItem: View {
} else if let longName = node.user?.longName {
desc = longName
} else {
desc = "unknown node"
desc = "Unknown".localized + " " + "Node".localized
}
if connected {
desc += ", currently connected"
@ -66,14 +66,13 @@ struct NodeListItem: View {
distanceFormatter.unitStyle = .medium
let formattedDistance = distanceFormatter.string(fromMeters: metersAway)
// For VoiceOver, prepend 'Distance' (localized)
desc += ", " + String(format: "%@: %@", NSLocalizedString("distance", comment: "Distance label for VoiceOver"), formattedDistance)
desc += ", " + String(format: "%@: %@", "Distance".localized, formattedDistance)
// Add bearing/heading information for VoiceOver
let trueBearing = getBearingBetweenTwoPoints(point1: myCoord, point2: nodeCoord)
let heading = Measurement(value: trueBearing, unit: UnitAngle.degrees)
let formattedHeading = heading.formatted(.measurement(width: .narrow, numberFormatStyle: .number.precision(.fractionLength(0))))
// Using a direct format without requiring a new localization key
desc += ", " + NSLocalizedString("heading", comment: "Heading label for VoiceOver") + " " + formattedHeading
desc += ", " + "Heading".localized + " " + formattedHeading
}
// Add signal strength if available
if node.snr != 0 && !node.viaMqtt {
@ -99,7 +98,6 @@ struct NodeListItem: View {
return desc
}
@ObservedObject var node: NodeInfoEntity
var connected: Bool
var connectedNode: Int64