luci.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. -- Copyright 2008 Steven Barth <steven@midlink.org>
  2. -- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
  3. -- Licensed to the public under the Apache License 2.0.
  4. require "luci.config"
  5. local fs = require "nixio.fs"
  6. m = Map("luci", translate("Web <abbr title=\"User Interface\">UI</abbr>"), translate("Here you can customize the settings and the functionality of <abbr title=\"Lua Configuration Interface\">LuCI</abbr>."))
  7. -- force reload of global luci config namespace to reflect the changes
  8. function m.commit_handler(self)
  9. package.loaded["luci.config"] = nil
  10. require "luci.config"
  11. end
  12. c = m:section(NamedSection, "main", "core", translate("General"))
  13. l = c:option(ListValue, "lang", translate("Language"))
  14. l:value("auto")
  15. local i18ndir = luci.i18n.i18ndir .. "base."
  16. for k, v in luci.util.kspairs(luci.config.languages) do
  17. local file = i18ndir .. k:gsub("_", "-")
  18. if k:sub(1, 1) ~= "." and fs.access(file .. ".lmo") then
  19. l:value(k, v)
  20. end
  21. end
  22. t = c:option(ListValue, "mediaurlbase", translate("Design"))
  23. for k, v in pairs(luci.config.themes) do
  24. if k:sub(1, 1) ~= "." then
  25. t:value(v, k)
  26. end
  27. end
  28. return m