summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-10-03 15:29:25 +0200
committerJo-Philipp Wich <jow@openwrt.org>2015-10-03 15:29:28 +0200
commit96b031bbad59555cb2523a3cab1d0a058b39455b (patch)
tree83aeda2767a419c61301024d71639649101da865 /applications
parent59d2f60a4206d6ac9e2c261ee75548973788549b (diff)
luci-app-statistics: rework graph label handling
Remove leftover unused translation code and properly escape colons in line labels. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications')
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/i18n.lua30
1 files changed, 7 insertions, 23 deletions
diff --git a/applications/luci-app-statistics/luasrc/statistics/i18n.lua b/applications/luci-app-statistics/luasrc/statistics/i18n.lua
index 5a2800d5f..7877e61ab 100644
--- a/applications/luci-app-statistics/luasrc/statistics/i18n.lua
+++ b/applications/luci-app-statistics/luasrc/statistics/i18n.lua
@@ -26,15 +26,6 @@ function Instance._subst( self, str, val )
return str
end
-function Instance._translate( self, key, alt )
- local val = self.i18n.string(key)
- if val ~= key then
- return val
- else
- return alt
- end
-end
-
function Instance.title( self, plugin, pinst, dtype, dinst, user_title )
local title = user_title or
@@ -73,24 +64,17 @@ end
function Instance.ds( self, source )
- local label = source.title or self:_translate(
- string.format( "stat_ds_%s_%s_%s", source.type, source.instance, source.ds ),
- self:_translate(
- string.format( "stat_ds_%s_%s", source.type, source.instance ),
- self:_translate(
- string.format( "stat_ds_label_%s__%s", source.type, source.ds ),
- self:_translate(
- string.format( "stat_ds_%s", source.type ),
- source.type .. "_" .. source.instance:gsub("[^%w]","_") .. "_" .. source.ds
- )
- )
- )
- )
+ local label = source.title or
+ "dt=%s/di=%s/ds=%s" % {
+ (source.type and #source.type > 0) and source.type or "(nil)",
+ (source.instance and #source.instance > 0) and source.instance or "(nil)",
+ (source.ds and #source.ds > 0) and source.ds or "(nil)"
+ }
return self:_subst( label, {
dtype = source.type,
dinst = source.instance,
dsrc = source.ds
- } )
+ } ):gsub(":", "\\:")
end