Module:User:Rua/pronunciation

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


local export = {}

local columns = {
	{code = "variety", display = "variety"},
	{code = "IPA", display = "]"},
	{code = "audio", display = "]"},
	{code = "homophones", display = "]"},
	{code = "hyphenation", display = "]"},
}

local lang = require("Module:languages").getLanguageByCode("nl")

function export.show(frame)
	local data = {
		{variety = "NL", IPA = "/ˈrɛizə(n)/", audio = "nl-reizen.ogg", hyphenation = "rei-zen", homophones = "rijzen"},
		{variety = "BE", IPA = "/ˈrɛːzə(n)/", hyphenation = "rei-zen", homophones = "rijzen"},
		}
	
	-- Determine which columns need to be displayed
	local found_columns = {}
	
	for _, row in ipairs(data) do
		for code, _ in pairs(row) do
			found_columns = true
		end
	end
	
	-- Format table
	for key, row in ipairs(data) do
		for _, col in ipairs(columns) do
			if found_columns then
				table.insert(row, process_value(col.code, row))
			end
		end
		
		data = "<tr><td>" .. table.concat(row, "</td><td>") .. "</td></tr>"
	end
	
	local head_row = {}
	
	for _, col in ipairs(columns) do
		if found_columns then
			table.insert(head_row, col.display)
		end
	end
	
	head_row = "<tr><th>" .. table.concat(head_row, "</th><th>") .. "</th></tr>"
	
	return "<table class=\"wikitable\">" .. head_row .. table.concat(data, "") .. "</table>"
end

function process_value(code, val)
	if not val then
		return ""
	elseif code == "variety" then
		local template = mw.title.new("Template:accent:" .. val)
		
		if template.exists then
			return mw.getCurrentFrame():expandTemplate{title = "Template:accent:" .. val, args = {}}
		else
			return val
		end
	elseif code == "IPA" then
		return mw.getCurrentFrame():expandTemplate{title = "IPAchar", args = {val}}
	elseif code == "audio" then
		return mw.getCurrentFrame():expandTemplate{title = "audio", args = {val, lang = lang:getCode()}}
	elseif code == "homophones" then
		return require("Module:links").full_link(val, nil, lang, nil, nil, nil, nil, nil)
	elseif code == "hyphenation" then
		return (val:gsub("-", "‧", nil))
	else
		return val
	end
end

return export