aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorPilzAdam <pilzadam@minetest.net>2015-10-25 10:56:58 +0100
committerPilzAdam <pilzadam@minetest.net>2015-10-25 10:56:58 +0100
commit6907c3e40a16d491fd0f7b224ba30a58e0777a24 (patch)
tree613a3aa4c4e7689c11597c815b858846382407ab /builtin
parent1f76808e4fa5a198f1dbddba6fa18ea1ecb20cb6 (diff)
downloadminetest-6907c3e40a16d491fd0f7b224ba30a58e0777a24.tar.gz
minetest-6907c3e40a16d491fd0f7b224ba30a58e0777a24.tar.bz2
minetest-6907c3e40a16d491fd0f7b224ba30a58e0777a24.zip
Escape " in generated settings_translation_file.cpp
Diffstat (limited to 'builtin')
-rw-r--r--builtin/mainmenu/tab_settings.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/builtin/mainmenu/tab_settings.lua b/builtin/mainmenu/tab_settings.lua
index 463a5e90b..d1ebb23ad 100644
--- a/builtin/mainmenu/tab_settings.lua
+++ b/builtin/mainmenu/tab_settings.lua
@@ -703,14 +703,17 @@ local function create_translation_file()
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