GSoC Commit #1: LuCId + HTTP-Server
[project/luci.git] / build / uvl2i18n.lua
1 #!/usr/bin/lua
2 -- uvl2i18n.lua - Convert uvl schemes to i18n files
3 -- $Id$
4
5 require("luci.util")
6 require("luci.uvl")
7
8 local shm = luci.uvl.UVL():get_scheme(arg[1])
9
10 for s, o in luci.util.kspairs(shm.sections) do
11 print( string.format( '%s_%s = %q', shm.name, s:gsub("_",""), o.title or s ) )
12
13 if o.description and #o.description > 0 then
14 print( string.format(
15 '%s_%s_desc = %q', shm.name, s:gsub("_",""), o.description
16 ) )
17 end
18
19 for v, o in luci.util.kspairs(shm.variables[s]) do
20 print( string.format(
21 '%s_%s_%s = %q', shm.name, s:gsub("_",""), v:gsub("_",""), o.title or v
22 ) )
23
24 if o.description and #o.description > 0 then
25 print( string.format(
26 '%s_%s_%s_desc = %q', shm.name, s:gsub("_",""),
27 v:gsub("_",""), o.description
28 ) )
29 end
30 end
31
32 print()
33 end