File: sub_quote_gettext.lua

package info (click to toggle)
enigma 1.30%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 76,132 kB
  • sloc: xml: 162,251; cpp: 67,393; ansic: 28,606; makefile: 1,986; sh: 1,298; yacc: 288; perl: 84; sed: 16
file content (20 lines) | stat: -rw-r--r-- 614 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env lua
-- sub_quote_gettext.lua
-- Copyright (c) 2006 Ronald Lamprecht
-- License: GPL2
-- Usage: lua sub_quote_gettext.lua level_i18n.in > level_i18n.cc 
-- Requires Lua 5.0 or above

-- substitutes inner not unescaped quotes to C-escaped quotes in gettext lines.

stdout = io.output()
for line in io.lines(arg[1]) do
    if (string.find(line,"gettext(",1,true) == 1) then
        stdout:write("gettext(\"" )
        s = string.gsub(string.sub(line, 10, string.len(line)-2), "\"", "\\\"")
        stdout:write(s)
        stdout:write("\")\n" )
    else
        stdout:write(line .. "\n" )
    end
end