mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-11-04 09:15:29 +01:00 
			
		
		
		
	settingtypes: Add no-c-format flag for xgettext
				
					
				
			This commit is contained in:
		@@ -102,7 +102,7 @@ end
 | 
			
		||||
local translation_file_header = [[
 | 
			
		||||
// This file is automatically generated
 | 
			
		||||
// 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() {]]
 | 
			
		||||
 | 
			
		||||
@@ -110,15 +110,15 @@ local function create_translation_file(settings)
 | 
			
		||||
	local result = { translation_file_header }
 | 
			
		||||
	for _, entry in ipairs(settings) do
 | 
			
		||||
		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
 | 
			
		||||
			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
 | 
			
		||||
			if entry.comment ~= "" then
 | 
			
		||||
				local comment_escaped = entry.comment:gsub("\n", "\\n")
 | 
			
		||||
				comment_escaped = comment_escaped:gsub("\"", "\\\"")
 | 
			
		||||
				insert(result, "\tgettext(\"" .. comment_escaped .. "\");")
 | 
			
		||||
				insert(result, "\t/* xgettext:no-c-format */ gettext(\"" .. comment_escaped .. "\");")
 | 
			
		||||
			end
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user