diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 2881b290..15b0fa30 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -38,18 +38,25 @@ } } }, - "%@ - %d Hops Towards %d Hops Back" : { + "%@ - %@ Towards %@ Back" : { "localizations" : { "en" : { "stringUnit" : { "state" : "new", - "value" : "%1$@ - %2$d Hops Towards %3$d Hops Back" + "value" : "%1$@ - %2$@ Towards %3$@ Back" } } } }, - "%@ - 1 Hop" : { - + "%@ - %d %@" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "%1$@ - %2$d %3$@" + } + } + } }, "%@ - Direct" : { @@ -24065,4 +24072,4 @@ } }, "version" : "1.0" -} +} \ No newline at end of file diff --git a/Meshtastic/Views/Nodes/TraceRouteLog.swift b/Meshtastic/Views/Nodes/TraceRouteLog.swift index e6e72841..6ffcc58f 100644 --- a/Meshtastic/Views/Nodes/TraceRouteLog.swift +++ b/Meshtastic/Views/Nodes/TraceRouteLog.swift @@ -37,14 +37,19 @@ struct TraceRouteLog: View { VStack { List(node.traceRoutes?.reversed() as? [TraceRouteEntity] ?? [], id: \.self, selection: $selectedRoute) { route in Label { - if route.response && route.hopsTowards == 0 { + if route.response && route.hopsTowards == 0 && route.hopsBack == 0 { Text("\(route.time?.formatted() ?? "unknown".localized) - Direct") .font(.caption) - } else if route.response && route.hopsTowards == 1 { - Text("\(route.time?.formatted() ?? "unknown".localized) - 1 Hop") + } else if route.response && route.hopsTowards == route.hopsBack { + let hopLabel = route.hopsTowards == 1 ? "Hop" : "Hops" + Text("\(route.time?.formatted() ?? "unknown".localized) - \(route.hopsTowards) \(hopLabel)") .font(.caption) } else if route.response { - Text("\(route.time?.formatted() ?? "unknown".localized) - \(route.hopsTowards) Hops Towards \(route.hopsBack) Hops Back") + let hopTowardsLabel = route.hopsTowards == 1 ? "Hop" : "Hops" + let hopBackLabel = route.hopsBack == 1 ? "Hop" : "Hops" + let hopTowardsString = (route.hopsTowards == 0) ? "Direct" : "\(route.hopsTowards) \(hopTowardsLabel)" + let hopBackString = (route.hopsBack == 0) ? "Direct" : "\(route.hopsBack) \(hopBackLabel)" + Text("\(route.time?.formatted() ?? "unknown".localized) - \(hopTowardsString) Towards \(hopBackString) Back") .font(.caption) } else if route.sent { Text("\(route.time?.formatted() ?? "unknown".localized) - No Response")