Module:fi-dialects/template/common


local export = {}
local m_links = require("Module:links")
local lang = require("Module:languages").getByCode("fi")

export.specials = { "standard", "common", "colloquial" }
export.special = {
	["standard"] = "Standard Finnish",
	["common"] = "Most common form <small>(found across dialects, including possibly some of the ones listed below)</small>",
	["colloquial"] = "(Urban) Colloquial Finnish"
}

export.disclaimer = "The classification of and data for regional dialects is based on pre-1950s data. Since the 1950s, the dialects have become increasingly mixed, levelled and influenced by Standard Finnish. Besides Standard Finnish, a relatively uniform and originally urban 'colloquial Finnish' is beginning to emerge in their place, especially in the cities."

function export.mention(term, gloss, usage)
	return m_links.full_link({ term = term, lang = lang, gloss = gloss, pos = usage }, "term")
end

function export.link(term)
	return m_links.full_link({ term = term, lang = lang })
end

function export.tag(term)
	return require("Module:script utilities").tag_text(term, lang)
end

function export.extract_text(term)
	return term
end

function export.make_link(term)
	return export.link(term)
end

function export.format_sources(sources)
	if not sources or #sources == 0 then
		return ""
	end
	
	local data = mw.loadData("Module:fi-dialects/data/source")
	local heading = #sources == 1 and "Source" or "Sources"
	local list = {}
	
	for _, source in ipairs(sources) do
		table.insert(list, data[source] or ("<" .. source .. ">"))
	end
	
	return "<p><small>" .. heading .. ": " .. table.concat(list, "; ") .. "</small></p>"
end

return export