X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-app-statistics%2Fluasrc%2Fstatistics%2Fi18n.lua;h=7877e61ab3063aa3b476a885c5962cf7f9844a5f;hp=ac7f1979af06d0e9afc9d77881728c15b1dde6c8;hb=967bb1f36f9f30d19e13aecf3a550eea5fd73c6b;hpb=7a3493b1f7d75a3945279115324cf2ff4da26b7b diff --git a/applications/luci-app-statistics/luasrc/statistics/i18n.lua b/applications/luci-app-statistics/luasrc/statistics/i18n.lua index ac7f1979a..7877e61ab 100644 --- a/applications/luci-app-statistics/luasrc/statistics/i18n.lua +++ b/applications/luci-app-statistics/luasrc/statistics/i18n.lua @@ -1,4 +1,4 @@ --- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich +-- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich -- Licensed to the public under the Apache License 2.0. module("luci.statistics.i18n", package.seeall) @@ -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