Skip to content

Commit

Permalink
Improve display of keep-alive options in OpenVPN configuration (#1038)
Browse files Browse the repository at this point in the history
Timeout was not displayed. Move options to a separate section.
  • Loading branch information
keeshux authored Dec 22, 2024
1 parent a187fd5 commit 6d62953
Show file tree
Hide file tree
Showing 17 changed files with 83 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ extension OpenVPNView {
if !isServerPushed {
moduleSection(for: tlsRows, header: Strings.Unlocalized.tls)
}
moduleSection(for: keepAliveRows, header: Strings.Global.Nouns.keepAlive)
moduleSection(for: otherRows, header: Strings.Global.Nouns.other)
}
}
Expand Down Expand Up @@ -316,11 +317,19 @@ private extension OpenVPNView.ConfigurationView {
return rows.nilIfEmpty
}

var otherRows: [ModuleRow]? {
var keepAliveRows: [ModuleRow]? {
var rows: [ModuleRow] = []
configuration.localizedDescription(optionalStyle: .keepAlive).map {
rows.append(.text(caption: Strings.Global.Nouns.keepAlive, value: $0))
rows.append(.text(caption: Strings.Global.Nouns.interval, value: $0))
}
configuration.localizedDescription(optionalStyle: .keepAliveTimeout).map {
rows.append(.text(caption: Strings.Global.Nouns.timeout, value: $0))
}
return rows.nilIfEmpty
}

var otherRows: [ModuleRow]? {
var rows: [ModuleRow] = []
configuration.localizedDescription(optionalStyle: .renegotiatesAfter).map {
rows.append(.text(caption: Strings.Modules.Openvpn.renegotiation, value: $0))
}
Expand Down
2 changes: 1 addition & 1 deletion Library/Sources/UILibrary/L10n/AppError+L10n.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ extension PassepartoutError.Code: StyledLocalizableEntity {
return V.dns

case .timeout:
return V.timeout
return Strings.Global.Nouns.timeout

case .OpenVPN.compressionMismatch:
return V.compression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ extension OpenVPN.Configuration.Builder: StyledOptionalLocalizableEntity {
public enum OptionalStyle {
case keepAlive

case keepAliveTimeout

case renegotiatesAfter

case randomizeEndpoint
Expand All @@ -172,6 +174,9 @@ extension OpenVPN.Configuration.Builder: StyledOptionalLocalizableEntity {
case .keepAlive:
return keepAliveInterval?.localizedDescription(style: .timeString)

case .keepAliveTimeout:
return keepAliveTimeout?.localizedDescription(style: .timeString)

case .renegotiatesAfter:
return renegotiatesAfter?.localizedDescription(style: .timeString)

Expand Down
6 changes: 4 additions & 2 deletions Library/Sources/UILibrary/L10n/SwiftGen+Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ public enum Strings {
public static let routing = Strings.tr("Localizable", "errors.tunnel.routing", fallback: "Missing routing")
/// Server shutdown
public static let shutdown = Strings.tr("Localizable", "errors.tunnel.shutdown", fallback: "Server shutdown")
/// Timeout
public static let timeout = Strings.tr("Localizable", "errors.tunnel.timeout", fallback: "Timeout")
/// TLS failed
public static let tls = Strings.tr("Localizable", "errors.tunnel.tls", fallback: "TLS failed")
}
Expand Down Expand Up @@ -272,6 +270,8 @@ public enum Strings {
public static let hostname = Strings.tr("Localizable", "global.nouns.hostname", fallback: "Hostname")
/// Interface
public static let interface = Strings.tr("Localizable", "global.nouns.interface", fallback: "Interface")
/// Interval
public static let interval = Strings.tr("Localizable", "global.nouns.interval", fallback: "Interval")
/// Keep-alive
public static let keepAlive = Strings.tr("Localizable", "global.nouns.keep_alive", fallback: "Keep-alive")
/// Key
Expand Down Expand Up @@ -340,6 +340,8 @@ public enum Strings {
public static let status = Strings.tr("Localizable", "global.nouns.status", fallback: "Status")
/// Subnet
public static let subnet = Strings.tr("Localizable", "global.nouns.subnet", fallback: "Subnet")
/// Timeout
public static let timeout = Strings.tr("Localizable", "global.nouns.timeout", fallback: "Timeout")
/// Unknown
public static let unknown = Strings.tr("Localizable", "global.nouns.unknown", fallback: "Unknown")
/// Username
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"errors.tunnel.ineligible" = "Kauf erforderlich";
"errors.tunnel.routing" = "Routing fehlt";
"errors.tunnel.shutdown" = "Server heruntergefahren";
"errors.tunnel.timeout" = "Zeitüberschreitung";
"errors.tunnel.tls" = "TLS fehlgeschlagen";
"features.appletv" = "%@";
"features.dns" = "DNS-Einstellungen";
Expand Down Expand Up @@ -90,12 +89,14 @@
"global.nouns.empty" = "Leer";
"global.nouns.enabled" = "Aktiviert";
"global.nouns.endpoint" = "Endpunkt";
"global.nouns.features" = "Funktionen";
"global.nouns.filters" = "Filter";
"global.nouns.folder" = "Ordner";
"global.nouns.gateway" = "Gateway";
"global.nouns.general" = "Allgemein";
"global.nouns.hostname" = "Host-Name";
"global.nouns.interface" = "Schnittstelle";
"global.nouns.interval" = "Intervall";
"global.nouns.keep_alive" = "Am Leben halten";
"global.nouns.key" = "Schlüssel";
"global.nouns.last_update" = "Letztes Update";
Expand All @@ -114,10 +115,12 @@
"global.nouns.password" = "Passwort";
"global.nouns.port" = "Port";
"global.nouns.private_key" = "Privater Schlüssel";
"global.nouns.products" = "Produkte"; // German
"global.nouns.profile" = "Profil";
"global.nouns.protocol" = "Protokoll";
"global.nouns.provider" = "Anbieter";
"global.nouns.public_key" = "Öffentlicher Schlüssel";
"global.nouns.purchases" = "Käufe";
"global.nouns.region" = "Region";
"global.nouns.route" = "Route";
"global.nouns.routes" = "Routen";
Expand All @@ -127,6 +130,7 @@
"global.nouns.settings" = "Einstellungen";
"global.nouns.status" = "Status";
"global.nouns.subnet" = "Subnetz";
"global.nouns.timeout" = "Zeitüberschreitung";
"global.nouns.unknown" = "Unbekannt";
"global.nouns.username" = "Benutzername";
"global.nouns.version" = "Version";
Expand Down Expand Up @@ -271,8 +275,6 @@
"views.purchased.rows.build_number" = "Build-Nummer";
"views.purchased.rows.download_date" = "Download-Datum";
"views.purchased.sections.download.header" = "Erster Download";
"global.nouns.features" = "Funktionen";
"global.nouns.purchases" = "Käufe";
"views.purchased.title" = "Gekauft";
"views.ui.connection_status.on_demand_suffix" = " (auf Anfrage)";
"views.ui.purchase_required.purchase.help" = "Kauf erforderlich";
Expand All @@ -281,4 +283,3 @@
"views.vpn.category.any" = "Alle Kategorien";
"views.vpn.no_servers" = "Keine Server";
"views.vpn.preset" = "Voreinstellung";
"global.nouns.products" = "Produkte"; // German
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"errors.tunnel.ineligible" = "Απαιτείται αγορά";
"errors.tunnel.routing" = "Η δρομολόγηση λείπει";
"errors.tunnel.shutdown" = "Ο διακομιστής τερματίστηκε";
"errors.tunnel.timeout" = "Λήξη χρόνου";
"errors.tunnel.tls" = "Το TLS απέτυχε";
"features.appletv" = "%@";
"features.dns" = "Ρυθμίσεις DNS";
Expand Down Expand Up @@ -90,12 +89,14 @@
"global.nouns.empty" = "Κενό";
"global.nouns.enabled" = "Ενεργοποιημένο";
"global.nouns.endpoint" = "Τελικό σημείο";
"global.nouns.features" = "Λειτουργίες";
"global.nouns.filters" = "Φίλτρα";
"global.nouns.folder" = "Φάκελος";
"global.nouns.gateway" = "Πύλη";
"global.nouns.general" = "Γενικά";
"global.nouns.hostname" = "Όνομα κεντρικού υπολογιστή";
"global.nouns.interface" = "Διασύνδεση";
"global.nouns.interval" = "Διάστημα";
"global.nouns.keep_alive" = "Διατήρηση ενεργού";
"global.nouns.key" = "Κλειδί";
"global.nouns.last_update" = "Τελευταία ενημέρωση";
Expand All @@ -114,10 +115,12 @@
"global.nouns.password" = "Κωδικός πρόσβασης";
"global.nouns.port" = "Θύρα";
"global.nouns.private_key" = "Ιδιωτικό κλειδί";
"global.nouns.products" = "Προϊόντα"; // Greek
"global.nouns.profile" = "Προφίλ";
"global.nouns.protocol" = "Πρωτόκολλο";
"global.nouns.provider" = "Πάροχος";
"global.nouns.public_key" = "Δημόσιο κλειδί";
"global.nouns.purchases" = "Αγορές";
"global.nouns.region" = "Περιοχή";
"global.nouns.route" = "Διαδρομή";
"global.nouns.routes" = "Διαδρομές";
Expand All @@ -127,6 +130,7 @@
"global.nouns.settings" = "Ρυθμίσεις";
"global.nouns.status" = "Κατάσταση";
"global.nouns.subnet" = "Υποδίκτυο";
"global.nouns.timeout" = "Λήξη χρόνου";
"global.nouns.unknown" = "Άγνωστο";
"global.nouns.username" = "Όνομα χρήστη";
"global.nouns.version" = "Έκδοση";
Expand Down Expand Up @@ -271,8 +275,6 @@
"views.purchased.rows.build_number" = "Αριθμός κατασκευής";
"views.purchased.rows.download_date" = "Ημερομηνία λήψης";
"views.purchased.sections.download.header" = "Πρώτη λήψη";
"global.nouns.features" = "Λειτουργίες";
"global.nouns.purchases" = "Αγορές";
"views.purchased.title" = "Αγορασμένα";
"views.ui.connection_status.on_demand_suffix" = " (κατ' απαίτηση)";
"views.ui.purchase_required.purchase.help" = "Απαιτείται αγορά";
Expand All @@ -281,4 +283,3 @@
"views.vpn.category.any" = "Όλες οι κατηγορίες";
"views.vpn.no_servers" = "Δεν υπάρχουν διακομιστές";
"views.vpn.preset" = "Προκαθορισμένο";
"global.nouns.products" = "Προϊόντα"; // Greek
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@
"global.nouns.general" = "General";
"global.nouns.hostname" = "Hostname";
"global.nouns.interface" = "Interface";
"global.nouns.interval" = "Interval";
"global.nouns.keep_alive" = "Keep-alive";
"global.nouns.key" = "Key";
"global.nouns.last_update" = "Last update";
Expand Down Expand Up @@ -308,6 +309,7 @@
"global.nouns.settings" = "Settings";
"global.nouns.status" = "Status";
"global.nouns.subnet" = "Subnet";
"global.nouns.timeout" = "Timeout";
"global.nouns.unknown" = "Unknown";
"global.nouns.username" = "Username";
"global.nouns.version" = "Version";
Expand Down Expand Up @@ -358,7 +360,6 @@
"errors.tunnel.ineligible" = "Purchase required";
"errors.tunnel.routing" = "Missing routing";
"errors.tunnel.shutdown" = "Server shutdown";
"errors.tunnel.timeout" = "Timeout";
"errors.tunnel.tls" = "TLS failed";

// MARK: Global (Theme)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"errors.tunnel.ineligible" = "Compra requerida";
"errors.tunnel.routing" = "Enrutamiento faltante";
"errors.tunnel.shutdown" = "Apagado del servidor";
"errors.tunnel.timeout" = "Tiempo de espera";
"errors.tunnel.tls" = "TLS fallido";
"features.appletv" = "%@";
"features.dns" = "Configuración de DNS";
Expand Down Expand Up @@ -90,12 +89,14 @@
"global.nouns.empty" = "Vacío";
"global.nouns.enabled" = "Habilitado";
"global.nouns.endpoint" = "Punto final";
"global.nouns.features" = "Funciones";
"global.nouns.filters" = "Filtros";
"global.nouns.folder" = "Carpeta";
"global.nouns.gateway" = "Puerta de enlace";
"global.nouns.general" = "General";
"global.nouns.hostname" = "Nombre de host";
"global.nouns.interface" = "Interfaz";
"global.nouns.interval" = "Intervalo";
"global.nouns.keep_alive" = "Mantener vivo";
"global.nouns.key" = "Clave";
"global.nouns.last_update" = "Última actualización";
Expand All @@ -114,10 +115,12 @@
"global.nouns.password" = "Contraseña";
"global.nouns.port" = "Puerto";
"global.nouns.private_key" = "Clave privada";
"global.nouns.products" = "Productos"; // Spanish
"global.nouns.profile" = "Perfil";
"global.nouns.protocol" = "Protocolo";
"global.nouns.provider" = "Proveedor";
"global.nouns.public_key" = "Clave pública";
"global.nouns.purchases" = "Compras";
"global.nouns.region" = "Región";
"global.nouns.route" = "Ruta";
"global.nouns.routes" = "Rutas";
Expand All @@ -127,6 +130,7 @@
"global.nouns.settings" = "Configuración";
"global.nouns.status" = "Estado";
"global.nouns.subnet" = "Subred";
"global.nouns.timeout" = "Tiempo de espera";
"global.nouns.unknown" = "Desconocido";
"global.nouns.username" = "Nombre de usuario";
"global.nouns.version" = "Versión";
Expand Down Expand Up @@ -271,8 +275,6 @@
"views.purchased.rows.build_number" = "Número de versión";
"views.purchased.rows.download_date" = "Fecha de descarga";
"views.purchased.sections.download.header" = "Primer descarga";
"global.nouns.features" = "Funciones";
"global.nouns.purchases" = "Compras";
"views.purchased.title" = "Comprado";
"views.ui.connection_status.on_demand_suffix" = " (a demanda)";
"views.ui.purchase_required.purchase.help" = "Compra requerida";
Expand All @@ -281,4 +283,3 @@
"views.vpn.category.any" = "Todas las categorías";
"views.vpn.no_servers" = "No hay servidores";
"views.vpn.preset" = "Preestablecido";
"global.nouns.products" = "Productos"; // Spanish
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"errors.tunnel.ineligible" = "Achat requis";
"errors.tunnel.routing" = "Routage manquant";
"errors.tunnel.shutdown" = "Arrêt du serveur";
"errors.tunnel.timeout" = "Délai d'attente";
"errors.tunnel.tls" = "Échec du TLS";
"features.appletv" = "%@";
"features.dns" = "Paramètres DNS";
Expand Down Expand Up @@ -90,12 +89,14 @@
"global.nouns.empty" = "Vide";
"global.nouns.enabled" = "Activé";
"global.nouns.endpoint" = "Point final";
"global.nouns.features" = "Fonctionnalités";
"global.nouns.filters" = "Filtres";
"global.nouns.folder" = "Dossier";
"global.nouns.gateway" = "Passerelle";
"global.nouns.general" = "Général";
"global.nouns.hostname" = "Nom d'hôte";
"global.nouns.interface" = "Interface";
"global.nouns.interval" = "Intervalle";
"global.nouns.keep_alive" = "Maintenir actif";
"global.nouns.key" = "Clé";
"global.nouns.last_update" = "Dernière mise à jour";
Expand All @@ -114,10 +115,12 @@
"global.nouns.password" = "Mot de passe";
"global.nouns.port" = "Port";
"global.nouns.private_key" = "Clé privée";
"global.nouns.products" = "Produits"; // French
"global.nouns.profile" = "Profil";
"global.nouns.protocol" = "Protocole";
"global.nouns.provider" = "Fournisseur";
"global.nouns.public_key" = "Clé publique";
"global.nouns.purchases" = "Achats";
"global.nouns.region" = "Région";
"global.nouns.route" = "Route";
"global.nouns.routes" = "Routes";
Expand All @@ -127,6 +130,7 @@
"global.nouns.settings" = "Paramètres";
"global.nouns.status" = "Statut";
"global.nouns.subnet" = "Sous-réseau";
"global.nouns.timeout" = "Délai d'attente";
"global.nouns.unknown" = "Inconnu";
"global.nouns.username" = "Nom d'utilisateur";
"global.nouns.version" = "Version";
Expand Down Expand Up @@ -271,8 +275,6 @@
"views.purchased.rows.build_number" = "Numéro de version";
"views.purchased.rows.download_date" = "Date de téléchargement";
"views.purchased.sections.download.header" = "Premier téléchargement";
"global.nouns.features" = "Fonctionnalités";
"global.nouns.purchases" = "Achats";
"views.purchased.title" = "Acheté";
"views.ui.connection_status.on_demand_suffix" = " (à la demande)";
"views.ui.purchase_required.purchase.help" = "Achat requis";
Expand All @@ -281,4 +283,3 @@
"views.vpn.category.any" = "Toutes les catégories";
"views.vpn.no_servers" = "Aucun serveur";
"views.vpn.preset" = "Préréglé";
"global.nouns.products" = "Produits"; // French
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"errors.tunnel.ineligible" = "Acquisto richiesto";
"errors.tunnel.routing" = "Routing mancante";
"errors.tunnel.shutdown" = "Spegnimento del server";
"errors.tunnel.timeout" = "Timeout";
"errors.tunnel.tls" = "TLS fallito";
"features.appletv" = "%@";
"features.dns" = "Impostazioni DNS";
Expand Down Expand Up @@ -90,12 +89,14 @@
"global.nouns.empty" = "Vuoto";
"global.nouns.enabled" = "Abilitato";
"global.nouns.endpoint" = "Endpoint";
"global.nouns.features" = "Funzionalità";
"global.nouns.filters" = "Filtri";
"global.nouns.folder" = "Cartella";
"global.nouns.gateway" = "Gateway";
"global.nouns.general" = "Generale";
"global.nouns.hostname" = "Nome host";
"global.nouns.interface" = "Interfaccia";
"global.nouns.interval" = "Intervallo";
"global.nouns.keep_alive" = "Keep-alive";
"global.nouns.key" = "Chiave";
"global.nouns.last_update" = "Ultimo aggiornamento";
Expand All @@ -114,10 +115,12 @@
"global.nouns.password" = "Password";
"global.nouns.port" = "Porta";
"global.nouns.private_key" = "Chiave privata";
"global.nouns.products" = "Prodotti"; // Italian
"global.nouns.profile" = "Profilo";
"global.nouns.protocol" = "Protocollo";
"global.nouns.provider" = "Provider";
"global.nouns.public_key" = "Chiave pubblica";
"global.nouns.purchases" = "Acquisti";
"global.nouns.region" = "Regione";
"global.nouns.route" = "Rotta";
"global.nouns.routes" = "Rotte";
Expand All @@ -127,6 +130,7 @@
"global.nouns.settings" = "Impostazioni";
"global.nouns.status" = "Stato";
"global.nouns.subnet" = "Subnet";
"global.nouns.timeout" = "Timeout";
"global.nouns.unknown" = "Sconosciuto";
"global.nouns.username" = "Nome utente";
"global.nouns.version" = "Versione";
Expand Down Expand Up @@ -271,8 +275,6 @@
"views.purchased.rows.build_number" = "Numero di build";
"views.purchased.rows.download_date" = "Data di download";
"views.purchased.sections.download.header" = "Primo download";
"global.nouns.features" = "Funzionalità";
"global.nouns.purchases" = "Acquisti";
"views.purchased.title" = "Acquistato";
"views.ui.connection_status.on_demand_suffix" = " (on-demand)";
"views.ui.purchase_required.purchase.help" = "Acquisto richiesto";
Expand All @@ -281,4 +283,3 @@
"views.vpn.category.any" = "Tutte le categorie";
"views.vpn.no_servers" = "Nessun server";
"views.vpn.preset" = "Preimpostato";
"global.nouns.products" = "Prodotti"; // Italian
Loading

0 comments on commit 6d62953

Please sign in to comment.