diff options
author | Y. Wang <yw05@forksworld.de> | 2022-09-13 13:23:50 +0200 |
---|---|---|
committer | Y. Wang <yw05@forksworld.de> | 2022-10-15 01:18:35 +0200 |
commit | ed7e3249b0d20e5e36ab258be6aa74b2ad15ebe6 (patch) | |
tree | aff5ce249e0ee1cc60aa5e58681c029985c9f623 /advtrains/locale/update-l10n.lua | |
parent | d8b842187dc3e66b2b3ad823f7d45c7f9ed927b5 (diff) | |
download | advtrains-ed7e3249b0d20e5e36ab258be6aa74b2ad15ebe6.tar.gz advtrains-ed7e3249b0d20e5e36ab258be6aa74b2ad15ebe6.tar.bz2 advtrains-ed7e3249b0d20e5e36ab258be6aa74b2ad15ebe6.zip |
Refactor GUI code; remove old l10n management scripts
Diffstat (limited to 'advtrains/locale/update-l10n.lua')
-rw-r--r-- | advtrains/locale/update-l10n.lua | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/advtrains/locale/update-l10n.lua b/advtrains/locale/update-l10n.lua deleted file mode 100644 index 7e56bf3..0000000 --- a/advtrains/locale/update-l10n.lua +++ /dev/null @@ -1,46 +0,0 @@ -local lang = tostring(arg[1]) or error("Invalid filename supplied") -local tfn = lang -local f = io.open(tfn, "rb") or error("Cannot read from translation file") -local tf = {} -for l in f:lines() do - tf[#tf+1] = l -end -f:close() - -local ot = {[0] = ""} -local f = io.open("template.txt", "rb") or error("Cannot read from translation template") -for l in f:lines() do - if l == "" then -- blank line - if ot[#ot] ~= l then ot[#ot+1] = l end - elseif l:find("^#") then -- comment - if ot[#ot] ~= l then ot[#ot+1] = l end - else - s = l:match("^(.+[^@]=)") - if s then - local found = false - for i = 1, #tf, 1 do - if tf[i]:find(s, 1, true) == 1 then - found = i - break - end - end - if found then - local fc = found-1 - while fc > 0 do - if not tf[fc]:find("^#") then break end - fc = fc-1 - end - for i = fc+1, found, 1 do - if ot[#ot] ~= tf[i] then ot[#ot+1] = tf[i] end - end - else - if ot[#ot] ~= l then ot[#ot+1] = l end - end - end - end -end -f:close() - -local f = io.open(tfn..".new", "wb") or error("Cannot write to translation file") -f:write(table.concat(ot,"\n")) -f:close() |