Localize layer 2 device page and some hosts pages

This commit is contained in:
Takayuki Onodera 2017-05-15 16:15:25 +09:00
parent 1ee2be27d3
commit 1aa15f980c
13 changed files with 115 additions and 44 deletions

View file

@ -52,13 +52,13 @@ print [[
<ul class="nav navbar-nav">
]]
print("<li><a href=\"#\">Mac: "..mac.."</A> </li>")
print("<li><a href=\"#\">"..i18n("details.mac")..": "..mac.."</A> </li>")
print("<li class=\"active\"><a href=\"#\"><i class=\"fa fa-home fa-lg\"></i>\n")
print("<li><a href='javascript:history.go(-1)'><i class='fa fa-reply'></i></a></li></ul></div></nav></div>")
print("<table class=\"table table-bordered table-striped\">\n")
print("<tr><th width=35%>MAC Address</th><td> "..mac)
print("<tr><th width=35%>"..i18n("mac_address").."</th><td> "..mac)
s = get_symbolic_mac(mac, true)
if(s ~= mac) then
@ -78,7 +78,7 @@ print(getHostIcon(mac))
local label = getHostAltName(mac)
if mac_info["num_hosts"] > 0 then
print(" [ <A HREF=\"".. ntop.getHttpPrefix().."/lua/hosts_stats.lua?mac="..mac.."\">Show Hosts</A> ]")
print(" [ <A HREF=\"".. ntop.getHttpPrefix().."/lua/hosts_stats.lua?mac="..mac.."\">"..i18n("details.show_hosts").."</A> ]")
end
print("</td>")
@ -93,7 +93,7 @@ if(isAdministrator()) then
pickIcon(mac)
print [[
&nbsp;<button type="submit" class="btn btn-default">Save</button>]]
&nbsp;<button type="submit" class="btn btn-default">]] print(i18n("save")) print[[</button>]]
print('<input id="csrf" name="csrf" type="hidden" value="'..ntop.getRandomCSRFValue()..'" />\n')
print [[</form>
</td></tr>
@ -106,21 +106,21 @@ print [[</form>
print("</td></tr>")
print("<tr><th>First / Last Seen</th><td nowrap><span id=first_seen>" .. formatEpoch(mac_info["seen.first"]) .. " [" .. secondsToTime(os.time()-mac_info["seen.first"]) .. " ago]" .. "</span></td>\n")
print("<td width='35%'><span id=last_seen>" .. formatEpoch(mac_info["seen.last"]) .. " [" .. secondsToTime(os.time()-mac_info["seen.last"]) .. " ago]" .. "</span></td></tr>\n")
print("<tr><th>".. i18n("details.first_last_seen") .. "</th><td nowrap><span id=first_seen>" .. formatEpoch(mac_info["seen.first"]) .. " [" .. secondsToTime(os.time()-mac_info["seen.first"]) .. " " .. i18n("details.ago").."]" .. "</span></td>\n")
print("<td width='35%'><span id=last_seen>" .. formatEpoch(mac_info["seen.last"]) .. " [" .. secondsToTime(os.time()-mac_info["seen.last"]) .. " " .. i18n("details.ago").."]" .. "</span></td></tr>\n")
if((mac_info["bytes.sent"]+mac_info["bytes.rcvd"]) > 0) then
print("<tr><th>Sent vs Received Traffic Breakdown</th><td colspan=2>")
print("<tr><th>" .. i18n("details.sent_vs_received_traffic_breakdown") .. "</th><td colspan=2>")
breakdownBar(mac_info["bytes.sent"], "Sent", mac_info["bytes.rcvd"], "Rcvd", 0, 100)
print("</td></tr>\n")
end
print("<tr><th>Traffic Sent / Received</th><td><span id=pkts_sent>" .. formatPackets(mac_info["packets.sent"]) .. "</span> / <span id=bytes_sent>".. bytesToSize(mac_info["bytes.sent"]) .. "</span> <span id=sent_trend></span></td><td><span id=pkts_rcvd>" .. formatPackets(mac_info["packets.rcvd"]) .. "</span> / <span id=bytes_rcvd>".. bytesToSize(mac_info["bytes.rcvd"]) .. "</span> <span id=rcvd_trend></span></td></tr>\n")
print("<tr><th>" .. i18n("details.traffic_sent_received") .. "</th><td><span id=pkts_sent>" .. formatPackets(mac_info["packets.sent"]) .. "</span> / <span id=bytes_sent>".. bytesToSize(mac_info["bytes.sent"]) .. "</span> <span id=sent_trend></span></td><td><span id=pkts_rcvd>" .. formatPackets(mac_info["packets.rcvd"]) .. "</span> / <span id=bytes_rcvd>".. bytesToSize(mac_info["bytes.rcvd"]) .. "</span> <span id=rcvd_trend></span></td></tr>\n")
print([[
<tr>
<th rowspan="2"><A HREF=https://en.wikipedia.org/wiki/Address_Resolution_Protocol>Address Resolution Protocol</A></th>
<th>ARP Requests</th>
<th>ARP Replies</th>
<th rowspan="2"><A HREF=https://en.wikipedia.org/wiki/Address_Resolution_Protocol>]]) print(i18n("details.address_resolution_protocol")) print[[</A></th>
<th>]] print(i18n("details.arp_requests")) print[[</th>
<th>]] print(i18n("details.arp_replies")) print([[</th>
</tr>
<tr>
<td>]]..formatValue(mac_info["arp_requests.sent"])..[[ Sent / ]]..formatValue(mac_info["arp_requests.rcvd"])..[[ Received</td>