From 1649635be46f37e62802f92a8ee53f831ed0e31b Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Thu, 31 May 2018 09:21:09 +0200
Subject: [PATCH] gluon-config-mode-contact-info: allow overriding contact
 field help and note in site

---
 docs/site-example/i18n/de.po                        | 13 +++++++++++++
 docs/site-example/i18n/en.po                        | 12 ++++++++++++
 docs/site-example/i18n/fr.po                        | 13 +++++++++++++
 docs/site-example/i18n/gluon-site.pot               |  6 ++++++
 docs/user/site.rst                                  |  6 ++++++
 .../gluon/config-mode/wizard/0500-contact-info.lua  |  9 ++++++---
 6 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/docs/site-example/i18n/de.po b/docs/site-example/i18n/de.po
index c5738333b..e4f59ecf5 100644
--- a/docs/site-example/i18n/de.po
+++ b/docs/site-example/i18n/de.po
@@ -67,3 +67,16 @@ msgid "gluon-config-mode:altitude-help"
 msgstr ""
 "Die Höhenangabe ist optional und sollte nur gesetzt werden, wenn ein "
 "exakter Wert bekannt ist."
+
+msgid "gluon-config-mode:contact-help"
+msgstr ""
+"Bitte hinterlege hier einen Hinweis, um anderen zu ermöglichen, "
+"Kontakt mit dir aufzunehmen. Beachte, dass dieser Hinweis auch "
+"<em>öffentlich</em> im Internet, zusammen mit den Koordinaten "
+"deines Knotens, einsehbar sein wird. Das bedeutet, dass diese Informationen "
+"von jedem heruntergeladen und verarbeitet werden können. Für den Betrieb sind diese "
+"Informationen nicht erforderlich. Eine Speicherung erfolgt auf diesem Knoten. "
+"Die Daten können durch dich in diesem Menü eigenständig gelöscht werden."
+
+msgid "gluon-config-mode:contact-note"
+msgstr "z.B. E-Mail oder Telefonnummer"
diff --git a/docs/site-example/i18n/en.po b/docs/site-example/i18n/en.po
index 0a014a3b1..02d7f822a 100644
--- a/docs/site-example/i18n/en.po
+++ b/docs/site-example/i18n/en.po
@@ -62,3 +62,15 @@ msgid "gluon-config-mode:altitude-help"
 msgstr ""
 "Specifying the altitude is optional and should only be done if a proper "
 "value is known."
+
+msgid "gluon-config-mode:contact-help"
+msgstr ""
+"Please provide your contact information here to allow others to contact "
+"you. Note that this information will be visible <em>publicly</em> on "
+"the internet together with your node's coordinates. This means it can be "
+"downloaded and processed by anyone. This information is "
+"not required to operate a node. If you chose to enter data, it will be "
+"stored on this node and can be deleted by yourself at any time."
+
+msgid "gluon-config-mode:contact-note"
+msgstr "e.g. E-mail or phone number"
diff --git a/docs/site-example/i18n/fr.po b/docs/site-example/i18n/fr.po
index 69522c4c2..aed423e17 100644
--- a/docs/site-example/i18n/fr.po
+++ b/docs/site-example/i18n/fr.po
@@ -62,3 +62,16 @@ msgid "gluon-config-mode:altitude-help"
 msgstr ""
 "La altitude est optionelle et ne devrait que être ajoutée si la valeur "
 "exacte est connue."
+
+msgid "gluon-config-mode:contact-help"
+msgstr ""
+"Entrez vos coordonnées ici si vous souhaitez permettre à d'autres "
+"personnes de communiquer avec vous. Ces informations seront affichées "
+"<em>en ligne</em> avec les coordonnées du nœud. Il peut être téléchargé "
+"et traité par tous. Il n'est pas obligatoire "
+"de fournir ces informations pour pouvoir opérer un nœud. Si vous avez "
+"choisi d'entrer des données, elles seront stockées sur ce nœud et vous "
+"pourrez les effacer par vous-même à tout moment."
+
+msgid "gluon-config-mode:contact-note"
+msgstr "Ex : E-mail ou numéro de téléphone"
diff --git a/docs/site-example/i18n/gluon-site.pot b/docs/site-example/i18n/gluon-site.pot
index b3138d285..3fb5c98bd 100644
--- a/docs/site-example/i18n/gluon-site.pot
+++ b/docs/site-example/i18n/gluon-site.pot
@@ -24,3 +24,9 @@ msgstr ""
 
 msgid "gluon-config-mode:altitude-help"
 msgstr ""
+
+msgid "gluon-config-mode:contact-help"
+msgstr ""
+
+msgid "gluon-config-mode:contact-note"
+msgstr ""
diff --git a/docs/user/site.rst b/docs/user/site.rst
index 8f19fa763..fd205d134 100644
--- a/docs/user/site.rst
+++ b/docs/user/site.rst
@@ -514,6 +514,12 @@ gluon-config-mode:altitude-label
 gluon-config-mode:altitude-help
     Description for the usage of the ``altitude`` field
 
+gluon-config-mode:contact-help
+    Description for the usage of the ``contact`` field
+
+gluon-config-mode:contact-note
+    Note shown (in small font) below the ``contact`` field
+
 gluon-config-mode:reboot
     General information shown on the reboot page.
 
diff --git a/package/gluon-config-mode-contact-info/luasrc/lib/gluon/config-mode/wizard/0500-contact-info.lua b/package/gluon-config-mode-contact-info/luasrc/lib/gluon/config-mode/wizard/0500-contact-info.lua
index 934107344..8309d87ab 100644
--- a/package/gluon-config-mode-contact-info/luasrc/lib/gluon/config-mode/wizard/0500-contact-info.lua
+++ b/package/gluon-config-mode-contact-info/luasrc/lib/gluon/config-mode/wizard/0500-contact-info.lua
@@ -1,20 +1,23 @@
 return function(form, uci)
 	local pkg_i18n = i18n 'gluon-config-mode-contact-info'
+	local site_i18n = i18n 'gluon-site'
 
 	local site = require 'gluon.site'
 
 	local owner = uci:get_first("gluon-node-info", "owner")
 
-	local s = form:section(Section, nil, pkg_i18n.translate(
+	local help = site_i18n._translate("gluon-config-mode:contact-help") or pkg_i18n.translate(
 		'Please provide your contact information here to allow others to contact '
 		.. 'you. Note that this information will be visible <em>publicly</em> on '
 		.. 'the internet together with your node\'s coordinates. This means it can '
 		.. 'be downloaded and processed by anyone. This information is '
 		.. 'not required to operate a node. If you chose to enter data, it will be '
 		.. 'stored on this node and can be deleted by yourself at any time.'
-	))
+	)
+	local s = form:section(Section, nil, help)
 
-	local o = s:option(Value, "contact", pkg_i18n.translate("Contact info"), pkg_i18n.translate("e.g. E-mail or phone number"))
+	local o = s:option(Value, "contact", pkg_i18n.translate("Contact info"),
+		site_i18n._translate("gluon-config-mode:contact-note") or pkg_i18n.translate("e.g. E-mail or phone number"))
 	o.default = uci:get("gluon-node-info", owner, "contact")
 	o.datatype = 'minlength(1)'
 	o.optional = true
-- 
GitLab