Skip to content

Localize dashboard labels & fix toggle state#3

Merged
joshcalvert47 merged 1 commit into
joshcalvert47:masterfrom
perez987:master
May 28, 2026
Merged

Localize dashboard labels & fix toggle state#3
joshcalvert47 merged 1 commit into
joshcalvert47:masterfrom
perez987:master

Conversation

@perez987

Copy link
Copy Markdown

Fix dashboard localization and Wi-Fi toggle state reactivity

Issues

The technical panel in the modern menu (IP Address, Channel, Router, PHY Mode, Noise, Connected, Signal Strength) was always rendered in English. The Wi-Fi toggle also always appeared "on" when reopening the menu, even when Wi-Fi was disabled.

Technical Dashboard Localization (NetworkDetailsDashboard)

Added String.Dashboard enum with NSLocalizedString-backed constants for all translatable dashboard labels. Translations for all 18 supported locales were derived from the existing " IP Address: "-style keys (stripping leading spaces and colon) and from "Wi-Fi: Connected". Technical terms (BSSID, SNR) are left untranslated intentionally.

enum Dashboard {
    static let connected = NSLocalizedString("Connected")
    static let signalStrength = NSLocalizedString("SIGNAL STRENGTH")
    static let ipAddress = NSLocalizedString("IP Address")
    // ...
}

Wi-Fi toggle reactivity (QuickToggleView / ModernToggleMenuItem)

PR #1 "Fix Wi-Fi toggle not updating visually when disabled" has not completely fixed the issue.

The toggle was backed by a plain Bool property. SwiftUI has no mechanism to detect when an external change to a plain property occurs, so the NSHostingView never re-rendered when isNetworkCardEnabled changed.

Fix: back the toggle with a WifiToggleState: ObservableObject (@Published var isOn). QuickToggleView uses @ObservedObject, so any external write to isOn triggers an automatic re-render. ModernToggleMenuItem exposes update(isOn:), called from isNetworkCardEnabled.willSet.

class WifiToggleState: ObservableObject {
    @Published var isOn: Bool
}

// In StatusMenuModern:
override var isNetworkCardEnabled: Bool {
    willSet(newState) {
        super.isNetworkCardEnabled = newState
        (statusItem as? ModernToggleMenuItem)?.update(isOn: newState)
    }
}

Note about versioning

On macOS, app release versioning generally follows the standard Major.Minor.Patch convention (e.g., 2.3.0).

I think it's a good idea to make this change to the Heliport versions. It's currently version 2.3, build 2.3. The version can change to 2.3.0 and the build to an integer that increments with each compilation in Xcode.

- Add localized strings for dashboard fields (Channel, Connected, IP Address, Noise, PHY Mode, Router, SIGNAL STRENGTH, etc.) in Localizable.xcstrings
- Bump project version/marketing version in project.pbxproj.
- Refactor the quick-toggle to use an ObservableObject (WifiToggleState) so SwiftUI views and the NSMenuItem stay in sync.
@perez987

Copy link
Copy Markdown
Author

@joshcalvert47
Dashboard labels localization

Before:

Technical-dashboard-en

After:

Technical-dashboard-es

@joshcalvert47 joshcalvert47 merged commit 1d76be1 into joshcalvert47:master May 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants