build: add script for po to lua conversation
[project/luci.git] / build / i18n-lua2xml.lua
1 #!/usr/bin/lua
2 local util = require "luci.util"
3
4 assert(arg[1])
5
6 local x = {}
7 local f = loadfile(arg[1])
8 setfenv(f, x)
9 f()
10
11 print '<?xml version="1.0" encoding="utf-8"?>'
12 print ''
13 print '<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">'
14 print ''
15
16 for k, v in util.kspairs(x) do
17 print ('<i18n:msg xml:id="%s">%s</i18n:msg>' % {k, v})
18 end
19
20 print ''
21 print '</i18n:msgs>'
22