diff options
author | ywang <yw05@forksworld.de> | 2021-03-28 13:02:16 +0200 |
---|---|---|
committer | ywang <yw05@forksworld.de> | 2021-05-25 19:18:57 +0200 |
commit | 15a056de432944815c5389e0ec544b993d3f3d40 (patch) | |
tree | 12f30d154f0b6d2bfa5b9193d39fa7fdcb493bfb /advtrains/locale/update-l10n.lua | |
parent | 35e0af272f10b53d9553bc1a207fdf10beab260c (diff) | |
download | advtrains-15a056de432944815c5389e0ec544b993d3f3d40.tar.gz advtrains-15a056de432944815c5389e0ec544b993d3f3d40.tar.bz2 advtrains-15a056de432944815c5389e0ec544b993d3f3d40.zip |
Make update-l10n.lua edit in place; use Sie-form for German translations
Diffstat (limited to 'advtrains/locale/update-l10n.lua')
-rw-r--r-- | advtrains/locale/update-l10n.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/advtrains/locale/update-l10n.lua b/advtrains/locale/update-l10n.lua index e0c2418..011f9c6 100644 --- a/advtrains/locale/update-l10n.lua +++ b/advtrains/locale/update-l10n.lua @@ -1,10 +1,14 @@ +local lang = arg[1] or error("No language supplied") +local tfn = string.format("advtrains.%s.tr", lang) +local f = io.open(tfn, "rb") or error("Cannot read from translation file") local tf = {} -for l in io.lines() do +for l in f:lines() do tf[#tf+1] = l end +f:close() local ot = {[0] = ""} -local f = io.open("template.txt") or error("Cannot open translation template") +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 @@ -35,7 +39,8 @@ for l in f:lines() do end end end +f:close() -for i = 1, #ot, 1 do - print(ot[i]) -end
\ No newline at end of file +local f = io.open(tfn, "wb") or error("Cannot write to translation file") +f:write(table.concat(ot,"\n")) +f:close()
\ No newline at end of file |