summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-network/htdocs
diff options
context:
space:
mode:
authorPaul Donald <newtwen@gmail.com>2023-12-07 04:09:39 +0100
committerPaul Donald <newtwen@gmail.com>2023-12-07 04:29:25 +0100
commite05ee9389735683bf277d962d2bb9ba1908bdf13 (patch)
tree7a58c7f9ec26a9fe3dd01811dda9690998316e47 /modules/luci-mod-network/htdocs
parent175a94325017964cc6e7e803c753399362c8b85f (diff)
luci-mod-network: Rework address helptext for DHCP
Ease translators lives. This introduces the function customi18n for positional string variables. Word and grammatical ordering of some languages breaks guarantees for positional string arguments. Signed-off-by: Paul Donald <newtwen@gmail.com>
Diffstat (limited to 'modules/luci-mod-network/htdocs')
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js
index 45a2e2573f..91b6e6a189 100644
--- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js
+++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js
@@ -308,12 +308,32 @@ return view.extend({
o.placeholder = '/example.org/10.1.2.3';
o.validate = validateServerSpec;
+ function customi18n(template, values) {
+ return template.replace(/\{(\w+)\}/g, (match, key) => values[key] || match);
+ };
+
o = s.taboption('general', form.DynamicList, 'address',
_('Addresses'),
_('Resolve specified FQDNs to an IP.') + '<br />' +
- _('Syntax: <code>/fqdn[/fqdn…]/[ipaddr]</code>.') + '<br />' +
- _('<code>/#/</code> matches any domain. <code>/example.com/</code> returns NXDOMAIN.') + '<br />' +
- _('<code>/example.com/#</code> returns NULL addresses (<code>0.0.0.0</code> and <code>::</code>) for example.com and its subdomains.'));
+ customi18n(_('Syntax: {code_syntax}.'),
+ {code_syntax: '<code>/fqdn[/fqdn…]/[ipaddr]</code>'}) + '<br />' +
+ customi18n(_('{example_nx} returns {nxdomain}.',
+ 'hint: <code>/example.com/</code> returns <code>NXDOMAIN</code>.'),
+ {example_nx: '<code>/example.com/</code>', nxdomain: '<code>NXDOMAIN</code>'}) + '<br />' +
+ customi18n(_('{any_domain} matches any domain (and returns {nxdomain}).',
+ 'hint: <code>/#/</code> matches any domain (and returns NXDOMAIN).'),
+ {any_domain:'<code>/#/</code>', nxdomain: '<code>NXDOMAIN</code>'}) + '<br />' +
+ customi18n(
+ _('{example_null} returns {null_addr} addresses ({null_ipv4}, {null_ipv6}) for {example_com} and its subdomains.',
+ 'hint: <code>/example.com/#</code> returns NULL addresses (<code>0.0.0.0</code>, <code>::</code>) for example.com and its subdomains.'),
+ { example_null: '<code>/example.com/#</code>',
+ null_addr: '<code>NULL</code>',
+ null_ipv4: '<code>0.0.0.0</code>',
+ null_ipv6: '<code>::</code>',
+ example_com: '<code>example.com</code>',
+ }
+ )
+ );
o.optional = true;
o.placeholder = '/router.local/router.lan/192.168.0.1';