diff options
author | Jo-Philipp Wich <jo@mein.io> | 2018-06-08 15:48:03 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2018-06-08 15:48:26 +0200 |
commit | 588c8618b6860cf88bfcf2262b104a86a5764f6e (patch) | |
tree | a91452e3486722d507db3d66281be30ca66db9fe | |
parent | 0e0ee2fed51f7108ee088e121ecbba479a5e88cc (diff) |
luci-mod-admin-full: fix translation interpolation in JS confirm() calls
Use luci.http.write_json() in conjunction with translate() to write out
unescaped translation strings in a manner suitable for interpolation inside
JavaScript.
Fixes #1870
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm | 4 | ||||
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm index f5c182e164..82ce4ad07f 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm @@ -33,7 +33,7 @@ <script type="text/javascript" src="<%=resource%>/cbi.js"></script> <script type="text/javascript">//<![CDATA[ function iface_shutdown(id, reconnect) { - if (!reconnect && !confirm(String.format('<%:Really shutdown interface "%s"? You might lose access to this device if you are connected via this interface.%>', id))) + if (!reconnect && !confirm(<%=luci.http.write_json(translate('Really shutdown interface "%s"? You might lose access to this device if you are connected via this interface.'))%>.format(id))) return; var d = document.getElementById(id + '-ifc-description'); @@ -67,7 +67,7 @@ } function iface_delete(id) { - if (!confirm('<%:Really delete this interface? The deletion cannot be undone! You might lose access to this device if you are connected via this interface.%>')) + if (!confirm(<%=luci.http.write_json(translate('Really delete this interface? The deletion cannot be undone! You might lose access to this device if you are connected via this interface'))%>)) return; (new XHR()).post('<%=url('admin/network/iface_delete')%>/' + id, { token: '<%=token%>' }, diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm index 4447ee3300..577f72842f 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm @@ -138,7 +138,7 @@ function wifi_shutdown(id, toggle) { var reconnect = (toggle.getAttribute('active') == 'false'); - if (!reconnect && !confirm(String.format('<%:Really shut down network?\nYou might lose access to this device if you are connected via this interface.%>'))) + if (!reconnect && !confirm(<%=luci.http.write_json(translate('Really shut down network? You might lose access to this device if you are connected via this interface'))%>)) return; is_reconnecting = true; @@ -176,7 +176,7 @@ } function wifi_delete(id) { - if (!confirm('<%:Really delete this wireless network? The deletion cannot be undone! You might lose access to this device if you are connected via this network.%>')) + if (!confirm(<%=luci.http.write_json(translate('Really delete this wireless network? The deletion cannot be undone! You might lose access to this device if you are connected via this network.'))%>)) return; (new XHR()).post('<%=url('admin/network/wireless_delete')%>/' + id, { token: '<%=token%>' }, |