From d46c5f89c5b319b2ced65cb238db55071965e5fa Mon Sep 17 00:00:00 2001
From: lemoer <git@irrelefant.net>
Date: Sun, 30 Oct 2022 14:15:34 +0100
Subject: [PATCH] gluon-web-network: show pretty interface names

---
 package/gluon-web-network/i18n/de.po           | 18 +++++++++---------
 package/gluon-web-network/i18n/fr.po           |  9 ---------
 .../i18n/gluon-web-network.pot                 | 18 +++++++++---------
 .../gluon/config-mode/model/admin/network.lua  | 10 ++++++++--
 4 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/package/gluon-web-network/i18n/de.po b/package/gluon-web-network/i18n/de.po
index 77b3a6a35..ccb29f48c 100644
--- a/package/gluon-web-network/i18n/de.po
+++ b/package/gluon-web-network/i18n/de.po
@@ -28,15 +28,6 @@ msgstr "PoE-Passthrough aktivieren"
 msgid "Enable PoE Power Port %s"
 msgstr "PoE-Ausgabe auf Port %s aktivieren"
 
-msgid "Enable meshing on the Ethernet interface"
-msgstr "Mesh auf dem Ethernet-Port aktivieren"
-
-msgid "Enable meshing on the LAN interface"
-msgstr "Mesh auf dem LAN-Port aktivieren"
-
-msgid "Enable meshing on the WAN interface"
-msgstr "Mesh auf dem WAN-Port aktivieren"
-
 msgid "Gateway"
 msgstr "Gateway"
 
@@ -49,6 +40,12 @@ msgstr "IPv4"
 msgid "IPv6"
 msgstr "IPv6"
 
+msgid "Interface"
+msgstr "Interface"
+
+msgid "LAN Interfaces"
+msgstr "LAN-Interfaces"
+
 msgid "Netmask"
 msgstr "Netzmaske"
 
@@ -61,5 +58,8 @@ msgstr "Statisch"
 msgid "Static DNS servers"
 msgstr "Statische DNS-Server"
 
+msgid "WAN Interfaces"
+msgstr "WAN-Interfaces"
+
 msgid "WAN connection"
 msgstr "WAN-Verbindung"
diff --git a/package/gluon-web-network/i18n/fr.po b/package/gluon-web-network/i18n/fr.po
index 97067343d..7bc898019 100644
--- a/package/gluon-web-network/i18n/fr.po
+++ b/package/gluon-web-network/i18n/fr.po
@@ -28,15 +28,6 @@ msgstr ""
 msgid "Enable PoE Power Port %s"
 msgstr ""
 
-msgid "Enable meshing on the Ethernet interface"
-msgstr ""
-
-msgid "Enable meshing on the LAN interface"
-msgstr "Activer le réseau MESH sur le port LAN"
-
-msgid "Enable meshing on the WAN interface"
-msgstr "Activer le réseau MESH sur les ports WAN"
-
 msgid "Gateway"
 msgstr "Passerelle"
 
diff --git a/package/gluon-web-network/i18n/gluon-web-network.pot b/package/gluon-web-network/i18n/gluon-web-network.pot
index a75929dfe..ce8cb39bd 100644
--- a/package/gluon-web-network/i18n/gluon-web-network.pot
+++ b/package/gluon-web-network/i18n/gluon-web-network.pot
@@ -19,15 +19,6 @@ msgstr ""
 msgid "Enable PoE Power Port %s"
 msgstr ""
 
-msgid "Enable meshing on the Ethernet interface"
-msgstr ""
-
-msgid "Enable meshing on the LAN interface"
-msgstr ""
-
-msgid "Enable meshing on the WAN interface"
-msgstr ""
-
 msgid "Gateway"
 msgstr ""
 
@@ -40,6 +31,12 @@ msgstr ""
 msgid "IPv6"
 msgstr ""
 
+msgid "Interface"
+msgstr ""
+
+msgid "LAN Interfaces"
+msgstr ""
+
 msgid "Netmask"
 msgstr ""
 
@@ -52,5 +49,8 @@ msgstr ""
 msgid "Static DNS servers"
 msgstr ""
 
+msgid "WAN Interfaces"
+msgstr ""
+
 msgid "WAN connection"
 msgstr ""
diff --git a/package/gluon-web-network/luasrc/lib/gluon/config-mode/model/admin/network.lua b/package/gluon-web-network/luasrc/lib/gluon/config-mode/model/admin/network.lua
index 31aeb902c..cf72341e3 100644
--- a/package/gluon-web-network/luasrc/lib/gluon/config-mode/model/admin/network.lua
+++ b/package/gluon-web-network/luasrc/lib/gluon/config-mode/model/admin/network.lua
@@ -75,12 +75,18 @@ end
 
 s = f:section(Section)
 
+local pretty_ifnames = {
+	["/wan"] = translate("WAN Interfaces"),
+	["/single"] = translate("Interface"),
+	["/lan"] = translate("LAN Interfaces")
+}
+
 uci:foreach('gluon', 'interface', function(config)
 	local section_name = config['.name']
-	local ifaces = s:option(MultiListValue, section_name, config.name)
+	local ifaces = s:option(MultiListValue, section_name, pretty_ifnames[config.name] or config.name)
 
 	ifaces.orientation = 'horizontal'
-	ifaces:value('uplink', 'Uplink') -- TODO: Uplink and Client should be mutually exclusive.
+	ifaces:value('uplink', 'Uplink')
 	ifaces:value('mesh', 'Mesh')
 	ifaces:value('client', 'Client')
 
-- 
GitLab