File: sub_quote_gettext.lua

package info (click to toggle)
enigma 1.20-dfsg.1-2.2
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 64,696 kB
  • sloc: xml: 153,614; cpp: 63,581; ansic: 31,088; sh: 4,825; makefile: 1,858; yacc: 288; perl: 84; sed: 16
file content (20 lines) | stat: -rw-r--r-- 614 bytes parent folder | download | duplicates (4)
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