Module:lect

Hello, you have come here looking for the meaning of the word Module:lect. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:lect, but we will also tell you about its etymology, its characteristics and you will know how to say Module:lect in singular and plural. Everything you need to know about the word Module:lect you have here. The definition of the word Module:lect will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:lect, 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.

Used by {{lect}}.


local export = {}

local m_languages = require("Module:languages")

function export.show(frame)
	
	local params = {
		 = { required = true },
		 = { required = true, list = true }
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local lang = args
	local lect = args
	local lectNames = {}
	
	if mw.title.getCurrentTitle().nsText == "Template" then
		if not lang then
			lang = "en"
		end
		if not lect then
			lect = { "en-GB", "en-US" }
		end
	end
		
	lang = m_languages.getByCode(lang)
		or require("Module:families").getByCode(lang)
		or m_languages.err(lang, 1)
	
	for i in pairs(lect) do
		local lectName = m_languages.getByCode(lect, nil, true)
			or m_languages.err(lect, i + 1)
		
		table.insert(lectNames, lectName:getCanonicalName())
	end
	
	local output = { table.concat(lectNames, ', ') }
	
	return table.concat(output)
	
end

return export