luci-app-statistics: add advice about data directory permissions
[project/luci.git] / applications / luci-app-statistics / luasrc / statistics / i18n.lua
index a1a2fa9..7877e61 100644 (file)
@@ -1,17 +1,5 @@
---[[
-
-Luci statistics - diagram i18n helper
-(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
-]]--
+-- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
 
 module("luci.statistics.i18n", package.seeall)
 
@@ -38,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
@@ -85,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