Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ControlWidgets/ControlWidgetsControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ struct ControlWidgetsControl: ControlWidget {
isOn: isConnected,
action: ToggleVPNIntent()
) { isOn in
Label(isOn ? "Connected" : "Disconnected", systemImage: "network")
.controlWidgetActionHint(isOn ? "Disconnect" : "Connect")
Label(isOn ? LocalizedStringResource("vpn_connected") : LocalizedStringResource("vpn_disconnected"), systemImage: "network")
.controlWidgetActionHint(isOn ? LocalizedStringResource("vpn_disconnect") : LocalizedStringResource("vpn_connect"))
Comment on lines +26 to +27
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LocalizedStringResource constructor should not be used to wrap localization keys. According to the pattern used elsewhere in the codebase (e.g., EasyTierShortcuts.swift), localization keys should be passed as string literals directly without wrapping them in LocalizedStringResource(). The compiler can automatically convert string literals to LocalizedStringResource.

Change from:

  • LocalizedStringResource("vpn_connected")
  • LocalizedStringResource("vpn_disconnected")
  • LocalizedStringResource("vpn_disconnect")
  • LocalizedStringResource("vpn_connect")

To:

  • "vpn_connected"
  • "vpn_disconnected"
  • "vpn_disconnect"
  • "vpn_connect"

Copilot uses AI. Check for mistakes.
}
}
.displayName("EasyTier")
.description("Toggle VPN connection")
.description(LocalizedStringResource("toggle_vpn_connection"))
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LocalizedStringResource constructor should not be used to wrap the localization key. Following the pattern used elsewhere in the codebase, the localization key should be passed as a string literal directly without wrapping it in LocalizedStringResource().

Change from:
LocalizedStringResource("toggle_vpn_connection")

To:
"toggle_vpn_connection"

Suggested change
.description(LocalizedStringResource("toggle_vpn_connection"))
.description("toggle_vpn_connection")

Copilot uses AI. Check for mistakes.
}
}

Expand All @@ -49,9 +49,9 @@ extension ControlWidgetsControl {
}

struct ToggleVPNIntent: SetValueIntent {
static let title: LocalizedStringResource = "Toggle VPN"
static let title: LocalizedStringResource = "toggle_vpn"

@Parameter(title: "Connected")
@Parameter(title: LocalizedStringResource("vpn_connected"))
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @parameter title should not use "vpn_connected" as it represents a boolean parameter for the connection state (both connected and disconnected states), not just the connected state. Consider using a more neutral localization key like "toggle_vpn" or a new key such as "vpn_state" that better represents both states.

Additionally, the LocalizedStringResource constructor should not be used. The localization key should be passed as a string literal directly.

Suggested change
@Parameter(title: LocalizedStringResource("vpn_connected"))
@Parameter(title: "vpn_state")

Copilot uses AI. Check for mistakes.
var value: Bool

func perform() async throws -> some IntentResult {
Expand Down
96 changes: 96 additions & 0 deletions EasyTier/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -2937,6 +2937,38 @@
}
}
},
"toggle_vpn" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Toggle VPN"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "切换 VPN"
}
}
}
},
"toggle_vpn_connection" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Toggle VPN connection"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "切换 VPN 连接"
}
}
}
},
"tunnel_proto" : {
"localizations" : {
"en" : {
Expand Down Expand Up @@ -3145,6 +3177,70 @@
}
}
},
"vpn_connect" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Connect"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "连接"
}
}
}
},
"vpn_connected" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Connected"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "已连接"
}
}
}
},
"vpn_disconnect" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Disconnect"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "断开"
}
}
}
},
"vpn_disconnected" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Disconnected"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "已断开"
}
}
}
},
"vpn_portal_client_network" : {
"localizations" : {
"en" : {
Expand Down