mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Settingtypes: Add no-c-format marker for xgettext
This commit is contained in:
parent
da7897a822
commit
71a507e8be
1 changed files with 4 additions and 4 deletions
|
@ -102,7 +102,7 @@ end
|
||||||
local translation_file_header = [[
|
local translation_file_header = [[
|
||||||
// This file is automatically generated
|
// This file is automatically generated
|
||||||
// It contains 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
|
// To update it, refer to the bottom of builtin/common/settings/init.lua
|
||||||
|
|
||||||
fake_function() {]]
|
fake_function() {]]
|
||||||
|
|
||||||
|
@ -110,15 +110,15 @@ local function create_translation_file(settings)
|
||||||
local result = { translation_file_header }
|
local result = { translation_file_header }
|
||||||
for _, entry in ipairs(settings) do
|
for _, entry in ipairs(settings) do
|
||||||
if entry.type == "category" then
|
if entry.type == "category" then
|
||||||
insert(result, sprintf("\tgettext(%q);", entry.name))
|
insert(result, sprintf("\t/* xgettext:no-c-format */ gettext(%q);", entry.name))
|
||||||
else
|
else
|
||||||
if entry.readable_name then
|
if entry.readable_name then
|
||||||
insert(result, sprintf("\tgettext(%q);", entry.readable_name))
|
insert(result, sprintf("\t/* xgettext:no-c-format */ gettext(%q);", entry.readable_name))
|
||||||
end
|
end
|
||||||
if entry.comment ~= "" then
|
if entry.comment ~= "" then
|
||||||
local comment_escaped = entry.comment:gsub("\n", "\\n")
|
local comment_escaped = entry.comment:gsub("\n", "\\n")
|
||||||
comment_escaped = comment_escaped:gsub("\"", "\\\"")
|
comment_escaped = comment_escaped:gsub("\"", "\\\"")
|
||||||
insert(result, "\tgettext(\"" .. comment_escaped .. "\");")
|
insert(result, "\t/* xgettext:no-c-format */ gettext(\"" .. comment_escaped .. "\");")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue