--Minetest --Copyright (C) 2020-2022 MultiCraft Development Team --Copyright (C) 2013 sapier -- --This program is free software; you can redistribute it and/or modify --it under the terms of the GNU Lesser General Public License as published by --the Free Software Foundation; either version 3.0 of the License, or --(at your option) any later version. -- --This program is distributed in the hope that it will be useful, --but WITHOUT ANY WARRANTY; without even the implied warranty of --MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --GNU Lesser General Public License for more details. -- --You should have received a copy of the GNU Lesser General Public License along --with this program; if not, write to the Free Software Foundation, Inc., --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. local function create_confirm_reset_dlg() return dialog_create("reset_all_settings", function() return "image_button[2,1;8,3;" .. core.formspec_escape(defaulttexturedir .. "blank.png") .. ";;" .. fgettext("Reset all settings?") .. ";true;false;]" .. "style[reset_confirm;bgcolor=red]" .. "button[3,4.8;3,0.5;reset_confirm;" .. fgettext("Reset") .. "]" .. "button[6,4.8;3,0.5;reset_cancel;" .. fgettext("Cancel") .. "]" end, function(this, fields) if fields["reset_confirm"] then for _, setting_name in ipairs(core.settings:get_names()) do if not setting_name:find(".", 1, true) and setting_name ~= "maintab_LAST" then core.settings:remove(setting_name) end end -- Reload the entire main menu dofile(core.get_builtin_path() .. "init.lua") return true end if fields["reset_cancel"] then this:delete() return true end end, nil, true) end -------------------------------------------------------------------------------- local labels = { node_highlighting = { fgettext("Node Outlining"), fgettext("Node Highlighting"), fgettext("None") } } local dd_options = { node_highlighting = { table.concat(labels.node_highlighting, ","), {"box", "halo", "none"} } } local getSettingIndex = { NodeHighlighting = function() local style = core.settings:get("node_highlighting") for idx, name in pairs(dd_options.node_highlighting[2]) do if style == name then return idx end end return 1 end } -- Get a list of languages and language names local path_locale = core.get_builtin_path() .. ".." .. DIR_DELIM .. "locale" local languages = core.get_dir_list(path_locale, true) local language_names = {} for i = #languages, 1, -1 do local language = languages[i] local f = io.open(path_locale .. DIR_DELIM .. language .. DIR_DELIM .. "LC_MESSAGES" .. DIR_DELIM .. "minetest.mo") if f then -- HACK local name = f:read("*a"):match("\nLanguage%-Team: ([^\\\n\"]+)