fix(apple): localize TLS connection problems

This commit is contained in:
Vincent Koc
2026-07-24 05:36:44 +02:00
parent 2f85a77cc1
commit a3911fe9ff
2 changed files with 13 additions and 3 deletions
@@ -764,8 +764,10 @@ extension GatewayConnectionProblemMapper {
title: "Gateway certificate unavailable",
message: "OpenClaw could not securely save the TLS certificate pin for \(failure.host).",
actionLabel: "Retry",
messagePresentation: .verbatim(
"OpenClaw could not securely save the TLS certificate pin for \(failure.host)."),
titlePresentation: .localized("Gateway certificate unavailable"),
messagePresentation: .localizedFormat(
"OpenClaw could not securely save the TLS certificate pin for %@.",
[failure.host]),
actionLabelPresentation: .localized("Retry"),
actionCommand: nil,
docsURL: URL(string: "https://docs.openclaw.ai/gateway/troubleshooting"),
@@ -779,7 +781,8 @@ extension GatewayConnectionProblemMapper {
title: "Gateway certificate is not trusted",
message: "The TLS challenge came from a different host or port than the requested Gateway.",
actionLabel: "Check certificate",
messagePresentation: .verbatim(
titlePresentation: .localized("Gateway certificate is not trusted"),
messagePresentation: .localized(
"The TLS challenge came from a different host or port than the requested Gateway."),
actionLabelPresentation: .localized("Check certificate"),
actionCommand: nil,
@@ -317,6 +317,10 @@ struct GatewayErrorsTests {
#expect(problem?.retryable == true)
#expect(problem?.pauseReconnect == false)
#expect(problem?.actionLabel == "Retry")
#expect(problem?.titlePresentation == .localized("Gateway certificate unavailable"))
#expect(problem?.messagePresentation == .localizedFormat(
"OpenClaw could not securely save the TLS certificate pin for %@.",
["gateway.example.com"]))
}
@Test func `TLS authority mismatch pauses reconnect`() {
@@ -337,6 +341,9 @@ struct GatewayErrorsTests {
#expect(problem?.retryable == false)
#expect(problem?.pauseReconnect == true)
#expect(problem?.actionLabel == "Check certificate")
#expect(problem?.titlePresentation == .localized("Gateway certificate is not trusted"))
#expect(problem?.messagePresentation == .localized(
"The TLS challenge came from a different host or port than the requested Gateway."))
}
@Test func `untrusted TLS mismatch cannot be recovered in app`() {