libs/core: explicitely load luci.i18n in network model
[project/luci.git] / libs / core / luasrc / model / uci.lua
index 270877677f2487a2cb0d21c8b2b0f681664c1d49..a394563047c37e2567325d4fee0d75c08e491ab2 100644 (file)
@@ -32,7 +32,7 @@ local table = require "table"
 local setmetatable, rawget, rawset = setmetatable, rawget, rawset
 local require, getmetatable = require, getmetatable
 local error, pairs, ipairs = error, pairs, ipairs
-local type, tostring, tonumber = type, tostring, tonumber
+local type, tostring, tonumber, unpack = type, tostring, tonumber, unpack
 
 --- LuCI UCI model library.
 -- The typical workflow for UCI is:  Get a cursor instance from the
@@ -69,9 +69,12 @@ local Cursor = getmetatable(inst)
 -- @param command                      Don't apply only return the command
 function Cursor.apply(self, configlist, command)
        configlist = self:_affected(configlist)
-       local reloadcmd = "/sbin/luci-reload " .. table.concat(configlist, " ")
-
-       return command and reloadcmd or os.execute(reloadcmd .. " >/dev/null 2>&1")
+       if command then
+               return { "/sbin/luci-reload", unpack(configlist) }
+       else
+               return os.execute("/sbin/luci-reload %s >/dev/null 2>&1"
+                       % table.concat(configlist, " "))
+       end
 end
 
 
@@ -184,7 +187,8 @@ function Cursor.get_first(self, conf, stype, opt, def)
                        if type(def) == "number" then
                                val = tonumber(val)
                        elseif type(def) == "boolean" then
-                               val = (val == "1" or val == "true" or val == "enabled")
+                               val = (val == "1" or val == "true" or
+                                      val == "yes" or val == "on")
                        end
 
                        if val ~= nil then