跳去內容

模組:labels/data/functions

來自維基辭典

呢個模組嘅解說可以喺模組:labels/data/functions/doc度開

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