value = value:trim()
if not value:match(CHAR_CLASSES.FLAGS .. "+")
or not setting.possible:match("[,]?" .. value .. "[,]?") then
- this.data.error_message = fgettext_ne("\"" .. value .. "\" is not a valid flag.")
+ this.data.error_message = fgettext_ne("\"$1\" is not a valid flag.", value)
this.data.entered_text = fields["te_setting_value"]
core.update_formspec(this:get_formspec())
return true
local settings = parse_config_file(true, false)
for _, entry in ipairs(settings) do
if entry.type == "category" then
- result = result .. "\tgettext(\"" .. entry.name .. "\");\n"
+ local name_escaped = entry.name:gsub("\"", "\\\"")
+ result = result .. "\tgettext(\"" .. name_escaped .. "\");\n"
else
if entry.readable_name then
- result = result .. "\tgettext(\"" .. entry.readable_name .. "\");\n"
+ local readable_name_escaped = entry.readable_name:gsub("\"", "\\\"")
+ result = result .. "\tgettext(\"" .. readable_name_escaped .. "\");\n"
end
if entry.comment ~= "" then
- local comment = entry.comment:gsub("\n", "\\n")
- result = result .. "\tgettext(\"" .. comment .. "\");\n"
+ local comment_escaped = entry.comment:gsub("\n", "\\n")
+ comment_escaped = comment_escaped:gsub("\"", "\\\"")
+ result = result .. "\tgettext(\"" .. comment_escaped .. "\");\n"
end
end
end