libs/uvl: fix i18n handling for errors
This commit is contained in:
parent
a3cf64006b
commit
5f0ecfe984
1 changed files with 4 additions and 7 deletions
|
@ -85,11 +85,11 @@ for i, v in ipairs(ERRCODES) do
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function i18n(key, def)
|
function i18n(key)
|
||||||
if luci.i18n then
|
if luci.i18n then
|
||||||
return luci.i18n.translate(key,def)
|
return luci.i18n.translate(key)
|
||||||
else
|
else
|
||||||
return def
|
return key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -130,10 +130,7 @@ end
|
||||||
function error.string(self,pad)
|
function error.string(self,pad)
|
||||||
pad = pad or " "
|
pad = pad or " "
|
||||||
|
|
||||||
local str = i18n(
|
local str = i18n(ERRCODES[self.code][2])
|
||||||
'uvl_err_%s' % string.lower(ERRCODES[self.code][1]),
|
|
||||||
ERRCODES[self.code][2]
|
|
||||||
)
|
|
||||||
:gsub("\n", "\n"..pad)
|
:gsub("\n", "\n"..pad)
|
||||||
:gsub("%%i", self:cid())
|
:gsub("%%i", self:cid())
|
||||||
:gsub("%%I", self:sid())
|
:gsub("%%I", self:sid())
|
||||||
|
|
Loading…
Reference in a new issue