mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Escape " in generated settings_translation_file.cpp
This commit is contained in:
parent
1f76808e4f
commit
6907c3e40a
3 changed files with 18 additions and 15 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue