aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/Tunnel/TunnelErrors.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-18 16:30:16 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-21 18:34:09 +0530
commit0552d75aa1d9e4e496bd066973fdf59726a4f235 (patch)
tree58b6a008f1ffeb974f7ca24ac51c98a971eaa41a /WireGuard/WireGuard/Tunnel/TunnelErrors.swift
parentTunnel detail: iPad: Handle deletion of tunnel correctly (diff)
downloadwireguard-apple-0552d75aa1d9e4e496bd066973fdf59726a4f235.tar.xz
wireguard-apple-0552d75aa1d9e4e496bd066973fdf59726a4f235.zip
Localize all the things
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/Tunnel/TunnelErrors.swift')
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelErrors.swift33
1 files changed, 17 insertions, 16 deletions
diff --git a/WireGuard/WireGuard/Tunnel/TunnelErrors.swift b/WireGuard/WireGuard/Tunnel/TunnelErrors.swift
index 45c20f6..c3d15b2 100644
--- a/WireGuard/WireGuard/Tunnel/TunnelErrors.swift
+++ b/WireGuard/WireGuard/Tunnel/TunnelErrors.swift
@@ -14,17 +14,17 @@ enum TunnelsManagerError: WireGuardAppError {
var alertText: AlertText {
switch self {
case .tunnelNameEmpty:
- return ("No name provided", "Cannot create tunnel with an empty name")
+ return (tr("alertTunnelNameEmptyTitle"), tr("alertTunnelNameEmptyMessage"))
case .tunnelAlreadyExistsWithThatName:
- return ("Name already exists", "A tunnel with that name already exists")
+ return (tr("alertTunnelAlreadyExistsWithThatNameTitle"), tr("alertTunnelAlreadyExistsWithThatNameMessage"))
case .systemErrorOnListingTunnels(let systemError):
- return ("Unable to list tunnels", systemError.UIString)
+ return (tr("alertSystemErrorOnListingTunnelsTitle"), systemError.localizedUIString)
case .systemErrorOnAddTunnel(let systemError):
- return ("Unable to create tunnel", systemError.UIString)
+ return (tr("alertSystemErrorOnAddTunnelTitle"), systemError.localizedUIString)
case .systemErrorOnModifyTunnel(let systemError):
- return ("Unable to modify tunnel", systemError.UIString)
+ return (tr("alertSystemErrorOnModifyTunnelTitle"), systemError.localizedUIString)
case .systemErrorOnRemoveTunnel(let systemError):
- return ("Unable to remove tunnel", systemError.UIString)
+ return (tr("alertSystemErrorOnRemoveTunnelTitle"), systemError.localizedUIString)
}
}
}
@@ -39,12 +39,13 @@ enum TunnelsManagerActivationAttemptError: WireGuardAppError {
var alertText: AlertText {
switch self {
case .tunnelIsNotInactive:
- return ("Activation failure", "The tunnel is already active or in the process of being activated")
+ return (tr("alertTunnelActivationErrorTunnelIsNotInactiveTitle"), tr("alertTunnelActivationErrorTunnelIsNotInactiveMessage"))
case .failedWhileStarting(let systemError),
.failedWhileSaving(let systemError),
.failedWhileLoading(let systemError),
.failedBecauseOfTooManyErrors(let systemError):
- return ("Activation failure", "The tunnel could not be activated. " + systemError.UIString)
+ return (tr("alertTunnelActivationSystemErrorTitle"),
+ tr(format: "alertTunnelActivationSystemErrorMessage (%@)", systemError.localizedUIString))
}
}
}
@@ -56,7 +57,7 @@ enum TunnelsManagerActivationError: WireGuardAppError {
var alertText: AlertText {
switch self {
case .activationFailed:
- return ("Activation failure", "The tunnel could not be activated. Please ensure that you are connected to the Internet.")
+ return (tr("alertTunnelActivationFailureTitle"), tr("alertTunnelActivationFailureMessage"))
case .activationFailedWithExtensionError(let title, let message):
return (title, message)
}
@@ -64,21 +65,21 @@ enum TunnelsManagerActivationError: WireGuardAppError {
}
extension Error {
- var UIString: String {
+ var localizedUIString: String {
if let systemError = self as? NEVPNError {
switch systemError {
case NEVPNError.configurationInvalid:
- return "The configuration is invalid."
+ return tr("alertSystemErrorMessageTunnelConfigurationInvalid")
case NEVPNError.configurationDisabled:
- return "The configuration is disabled."
+ return tr("alertSystemErrorMessageTunnelConfigurationDisabled")
case NEVPNError.connectionFailed:
- return "The connection failed."
+ return tr("alertSystemErrorMessageTunnelConnectionFailed")
case NEVPNError.configurationStale:
- return "The configuration is stale."
+ return tr("alertSystemErrorMessageTunnelConfigurationStale")
case NEVPNError.configurationReadWriteFailed:
- return "Reading or writing the configuration failed."
+ return tr("alertSystemErrorMessageTunnelConfigurationReadWriteFailed")
case NEVPNError.configurationUnknown:
- return "Unknown system error."
+ return tr("alertSystemErrorMessageTunnelConfigurationUnknown")
default:
return ""
}