Fix language selection broken after po file merges
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_index / luci.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14 require("luci.config")
15 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>."))
16
17 local fs = require "nixio.fs"
18
19 -- force reload of global luci config namespace to reflect the changes
20 function m.commit_handler(self)
21         package.loaded["luci.config"] = nil
22         require("luci.config")
23 end
24
25
26 c = m:section(NamedSection, "main", "core", translate("General"))
27
28 l = c:option(ListValue, "lang", translate("Language"))
29 l:value("auto")
30
31 local i18ndir = luci.i18n.i18ndir .. "base."
32 for k, v in luci.util.kspairs(luci.config.languages) do
33         local file = i18ndir .. k:gsub("_", "-")
34         if k:sub(1, 1) ~= "." and fs.access(file .. ".lmo") then
35                 l:value(k, v)
36         end
37 end
38
39 t = c:option(ListValue, "mediaurlbase", translate("Design"))
40 for k, v in pairs(luci.config.themes) do
41         if k:sub(1, 1) ~= "." then
42                 t:value(v, k)
43         end
44 end
45
46 u = m:section(NamedSection, "uci_oncommit", "event", translate("Post-commit actions"),
47  translate("These commands will be executed automatically when a given <abbr title=\"Unified Configuration Interface\">UCI</abbr> configuration is committed allowing changes to be applied instantly."))
48 u.dynamic = true
49
50 f = m:section(NamedSection, "flash_keep", "extern", translate("Files to be kept when flashing a new firmware"),
51  translate("When flashing a new firmware with <abbr title=\"Lua Configuration Interface\">LuCI</abbr> these files will be added to the new firmware installation."))
52 f.dynamic = true
53
54 return m