Module:labels/analysis

Hello, you have come here looking for the meaning of the word Module:labels/analysis. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:labels/analysis, but we will also tell you about its etymology, its characteristics and you will know how to say Module:labels/analysis in singular and plural. Everything you need to know about the word Module:labels/analysis you have here. The definition of the word Module:labels/analysis will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:labels/analysis, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

function export.printConflicts(frame)
	local m_labeldata = mw.loadData("Module:labels/data")
	
	local replacements = m_labeldata.replacements
	
	local output = {"; labels:"}
	
	local labels = {}
	
	for label, data in pairs(replacements.labels) do
		local lang, langCode
		if data.languages then
			langCode = data.languages
			lang = require("Module:languages").getByCode(langCode)
		end
		
		local canonicalName
		if lang then
			canonicalName = lang.getCanonicalName()
		end
		
		table.insert(labels, label)
		
		if langCode or canonicalName then
			table.insert(output, " (")
		end
		
		if langCode then
			table.insert(output, "<code>" .. langCode .. "</code>")
		end
		
		if canonicalName then
			if langCode then
				table.insert(output, ", ")
			end
			
			table.insert(output, canonicalName)
		end
		
		if langCode or canonicalName then
			table.insert(output, ")")
		end
	end
	
	table.sort(labels)
	
	for _, label in ipairs(labels) do
		table.insert(output, "\n* " .. label)
	end
	
	return table.concat(output)
end

function export.printUnused(frame)
	local withoutLanguage = require("Module:array")()
	for label, data in pairs(require("Module:labels/data/subvarieties").labels) do
		if not data.language then
			table.insert(withoutLanguage, label)
		end
	end
	return withoutLanguage
		:map(
			function(label)
				return "* <code>" .. label .. "</code>"
			end)
		:concat("\n")
end

return export