; charset=UTF-8 Last-Modified: Tue, 20 Oct 2026 11:05:13 GMT Expires: Fri, 17 Oct 2036 11:05:13 GMT advtrains.git - Advtrains mod for minetest.
aboutsummaryrefslogtreecommitdiff
ModeNameSize
-rw-r--r--.build.yml1710logplain
-rw-r--r--.dir-locals.el177logplain
-rw-r--r--.gitignore79logplain
-rw-r--r--README.md2770logplain
d---------advtrains1564logplain
d---------advtrains_interlocking863logplain
d---------advtrains_line_automation690logplain
d---------advtrains_luaautomation690logplain
d---------advtrains_signals_japan145logplain
d---------advtrains_signals_ks222logplain
d---------advtrains_signals_muc_ubahn140logplain
d---------advtrains_trackmap186logplain
d---------advtrains_train_track184logplain
d---------assets2155logplain
-rw-r--r--atc_command.txt3489logplain
-rw-r--r--description.txt145logplain
-rw-r--r--license.txt32367logplain
-rw-r--r--license_media.txt20744logplain
-rwxr-xr-xmake_release.sh1199logplain
-rw-r--r--modpack.conf238logplain
-rw-r--r--privilege_guide.txt2273logplain
-rw-r--r--screenshot.png809738logplain
d---------serialize_lib336logplain
-rwxr-xr-xupdate-translations.sh603logplain
pos-1)), epos+1 end end end local function readstring(str, pos) local st = {} local nxt = pos while true do local s, npos = readstring_aux(str, nxt) if not s then if not st[1] then return nil, nxt else return table.concat(st), nxt end end nxt = npos table.insert(st, s) end end local function readtoken(str, pos) local _, epos, tok = string.find(str, [[^%s*(%S+)]], pos) if epos == nil then return nil, pos end return tok, epos+1 end local function readcomment_add_flags(flags, s) for flag in string.gmatch(s, ",%s*([^,]+)") do flags[flag] = true end end local function readcomment_aux(str, pos) local _, epos, sval = string.find(str, "^[\r\n]*#([^\r\n]*)", pos) if not epos then return nil end return sval, epos+1 end local function readcomment(str, pos) local st = {} local nxt = pos local flags = {} while true do local s, npos = readcomment_aux(str, nxt) if not npos then local t = { comment = table.concat(st, "\n"), flags = flags, } return t, nxt end if string.sub(s, 1, 1) == "," then readcomment_add_flags(flags, s) end table.insert(st, s) nxt = npos end end local function readpo(str) local st = {} local pos = 1 while true do local entry, nxt = readcomment(str, pos) local msglines = 0 while true do local tok, npos = readtoken(str, nxt) if tok == nil or string.sub(tok, 1, 1) == "#" then break elseif string.sub(tok, 1, 3) ~= "msg" then return error("Invalid token: " .. tok) elseif entry[tok] ~= nil then break else local value, npos = readstring(str, npos) assert(value ~= nil, "No string provided for " .. tok) entry[tok] = value nxt = npos msglines = msglines+1 end end if msglines == 0 then return st elseif entry.msgid ~= "" then assert(entry.msgid ~= nil, "Missing untranslated string") assert(entry.msgstr ~= nil, "Missing translated string") table.insert(st, entry) end pos = nxt end end local escape_lookup = { ["="] = "@=", ["\n"] = "@n" } local function escape_string(st) return (string.gsub(st, "[=\n]", escape_lookup)) end local function convert_po_string(textdomain, str) local st = {string.format("# textdomain: %s", textdomain)} for _, entry in ipairs(readpo(str)) do local line = ("%s=%s"):format(escape_string(entry.msgid), escape_string(entry.msgstr)) if entry.flags.fuzzy then line = "#" .. line end table.insert(st, line) end return table.concat(st, "\n") end local function convert_po_file(textdomain, inpath, outpath) local f, err = io.open(inpath, "rb") assert(f, err) local str = convert_po_string(textdomain, f:read("*a")) f:close() minetest.safe_file_write(outpath, str) return str end local function convert_flat_po_directory(textdomain, modpath) assert(textdomain, "No textdomain specified for po file conversion") local mp = modpath or minetest.get_modpath(textdomain) assert(mp ~= nil, "No path to write for " .. textdomain) local popath = mp .. "/po" local trpath = mp .. "/locale" for _, infile in pairs(minetest.get_dir_list(popath, false)) do local lang = string.match(infile, [[^([^%.]+)%.po$]]) if lang then local inpath = popath .. "/" .. infile local outpath = ("%s/%s.%s.tr"):format(trpath, textdomain, lang) convert_po_file(textdomain, inpath, outpath) end end end return { from_string = convert_po_string, from_file = convert_po_file, from_flat = convert_flat_po_directory, }