]> git.lizzy.rs Git - minetest.git/blobdiff - builtin/mainmenu/generate_from_settingtypes.lua
Remove Irrlicht documentation URL from key settings (#13010)
[minetest.git] / builtin / mainmenu / generate_from_settingtypes.lua
index 43fc57bb99030918c3592b7c5c47a61c5c07a15a..79bc94c51e1ec722e772e49e0ca22bdb2992f0c0 100644 (file)
@@ -18,7 +18,7 @@ local minetest_example_header = [[
 #    to the program, eg. "minetest.exe --config ../minetest.conf.example".
 
 #    Further documentation:
-#    http://wiki.minetest.net/
+#    https://wiki.minetest.net/
 
 ]]
 
@@ -31,7 +31,7 @@ local group_format_template = [[
 #    octaves     = %s,
 #    persistence = %s,
 #    lacunarity  = %s,
-#    flags       = %s
+#    flags       =%s
 # }
 
 ]]
@@ -55,9 +55,17 @@ local function create_minetest_conf_example()
                        end
                        if entry.comment ~= "" then
                                for _, comment_line in ipairs(entry.comment:split("\n", true)) do
-                                       insert(result, "#    " .. comment_line .. "\n")
+                                       if comment_line == "" then
+                                               insert(result, "#\n")
+                                       else
+                                               insert(result, "#    " .. comment_line .. "\n")
+                                       end
                                end
                        end
+                       if entry.type == "key" then
+                               local line = "See https://github.com/minetest/irrlicht/blob/master/include/Keycodes.h"
+                               insert(result, "#    " .. line .. "\n")
+                       end
                        insert(result, "#    type: " .. entry.type)
                        if entry.min then
                                insert(result, " min: " .. entry.min)
@@ -73,10 +81,14 @@ local function create_minetest_conf_example()
                        end
                        insert(result, "\n")
                        if group_format == true then
+                               local flags = entry.values[10]
+                               if flags ~= "" then
+                                       flags = " "..flags
+                               end
                                insert(result, sprintf(group_format_template, entry.name, entry.values[1],
                                                entry.values[2], entry.values[3], entry.values[4], entry.values[5],
                                                entry.values[6], entry.values[7], entry.values[8], entry.values[9],
-                                               entry.values[10]))
+                                               flags))
                        else
                                local append
                                if entry.default ~= "" then
@@ -91,7 +103,7 @@ end
 
 local translation_file_header = [[
 // This file is automatically generated
-// It conatins a bunch of fake gettext calls, to tell xgettext about the strings in config files
+// It contains a bunch of fake gettext calls, to tell xgettext about the strings in config files
 // To update it, refer to the bottom of builtin/mainmenu/dlg_settings_advanced.lua
 
 fake_function() {]]
@@ -101,6 +113,9 @@ local function create_translation_file()
        for _, entry in ipairs(settings) do
                if entry.type == "category" then
                        insert(result, sprintf("\tgettext(%q);", entry.name))
+               elseif entry.type == "key" then --luacheck: ignore
+                       -- Neither names nor descriptions of keys are used since we have a
+                       -- dedicated menu for them.
                else
                        if entry.readable_name then
                                insert(result, sprintf("\tgettext(%q);", entry.readable_name))
@@ -126,4 +141,3 @@ file = assert(io.open("src/settings_translation_file.cpp", "w"))
 --file = assert(io.open("settings_translation_file.cpp", "w"))
 file:write(create_translation_file())
 file:close()
-