aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_mainmenu.cpp
Commit message (Expand)AuthorAge
...
* Fix various points reported by cppcheck (#5656)Loïc Blot2017-04-25
* [CSM] sound_play & sound_stop support + client_lua_api doc (#5096)Loïc Blot2017-03-13
* Serverlist: Add ping indicators (#5164)kilbith2017-02-03
* Add version APIShadowNinja2016-10-31
* Mapgen: Refactor mapgen creation and managementkwolekr2016-07-03
* Add option to not send pre v25 init packetest312016-03-15
* Remove wstrgettextest312015-10-18
* Hide mapgens from main menu not intended for end userskwolekr2015-10-04
* Add emerge completion callback mechanismkwolekr2015-10-04
* Optional reconnect functionalityest312015-07-23
* Use UTF-8 instead of narrowest312015-07-08
* Use utf-8 in formspecsIlya Zhuravlev2015-06-13
* Add core.get_dir_listShadowNinja2015-05-16
* Move globals from main.cpp to more sane locationsCraig Robbins2015-04-01
* Fix typoCraig Robbins2015-03-29
* Add Lua function get_video_modes() for main menuCraig Robbins2015-03-28
* Clean up and tweak build systemShadowNinja2015-03-27
* Fix game minetest.conf default settingsest312015-03-18
* For usages of assert() that are meant to persist in Release builds (when NDEB...Craig Robbins2015-03-07
* Server: announce MIN/MAX protocol version supported to serverlist. Client: ch...est312015-02-18
* Fix .zip extraction (mod store)ngosang2015-02-12
* Reduce gettext wide/narrow and string/char* conversionsShadowNinja2015-02-05
* Fix all warnings and remove -Wno-unused-but-set cflagkwolekr2015-01-18
* Reorganize supported video driver query mechanismskwolekr2015-01-18
* Add core.get_mapgen_names() to Main Menu API (and use it)kwolekr2014-12-29
* Add video driver selection to settings menu (based uppon idea from webdesigne...sapier2014-08-23
* Fix the *CDP displaySmallJoker2014-08-15
* Remove a lot of superfluous ifndef USE_CURL checkssapier2014-06-19
* Fix regression dirt texture not beeing default in non cloud menusapier2014-06-14
* Organize builtin into subdirectoriesShadowNinja2014-05-07
* Fix code style of async APIShadowNinja2014-04-27
* Remove dependency on marshal and many other async changesShadowNinja2014-04-27
* Add support for dpi based HUD scalingsapier2014-04-27
* Minor fixes for file/modlist download in mainmenusapier2014-04-09
* Fix invalid check for fread error on extracting zipsapier2014-02-07
* Add formspec tableKahrl2014-01-13
* Fix absence of images when compiled with RUN_IN_PLACE=0.Ilya Zhuravlev2014-01-05
* Implement search tab and version pickersapier2013-12-11
* Fix modstore/favourites hang by adding asynchronous lua job supportsapier2013-11-29
* Fix invalid usage of temporary object in mainmenu json conversionsapier2013-11-11
* Show git hash in version string at top left corner of windowKahrl2013-09-28
* Fix umlauts/special character issue in lua gettextBlockMen2013-08-19
* Allow SIGINT to kill mainmenu againKahrl2013-08-19
* Add translation for main menusapier2013-08-17
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
>(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, "^\n*#([^\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, }