Modul:labels/data/functions

A modult a Modul:labels/data/functions/doc lapon tudod dokumentálni

export = {}

function export.handle_languages(labels)
	if type(labels) ~= "table" then
		error('The function "handle_languages" requires a table as argument.')
	end
	
	for label, data in pairs(labels) do
		if data["languages"] then
			for key, language in ipairs(data["languages"] or {}) do
				labels[label]["languages"][language] = true
			end
		elseif data["language"] and data["language"] ~= "" then
			labels[label]["languages"] = {}
			labels[label]["languages"][data["language"]] = true
		end
	end
end

return export