Modül:th-eşs

Vikisözlük sitesinden
Modül belgelemesi [Düzenle] [Tazele]


local cikart = {}
local dil = require("Modül:diller").getirKodaGore("th")
local PAGENAME = mw.title.getCurrentTitle().text

local function getHomophones(reading)
	
	return require('Modül:th-eşs/veri')[reading] or {}
	
end

-- can be called from another module
function cikart.makeList(reading)
	
	local result = {}
	local categories = {}
	
	local homList = getHomophones(reading)
	if #homList > 1 then
		for _,sozcuk in ipairs(homList) do
			-- skip if same word
			if sozcuk ~= PAGENAME then
				table.insert(result, require('Modül:bağlantılar').tam_bag({dil = dil, sozcuk = sozcuk, c = '-'}))
			end
		end
		if mw.title.getCurrentTitle().namespace == 0 then
			table.insert(categories, "Tayca eşseslileri olan sözcükler")
		end
	end
	
	return table.concat(result, ', ')
		.. require('Modül:araçlar').format_categories(categories, lang)
	
end

function cikart.show(frame)
	
	local args = frame:getParent().args
	local reading = args[1] or PAGENAME
	local output = cikart.makeList(reading)
	
	if output ~= '' then
		output = 'Homophones: ' .. output
	end
	return output
	
end

return cikart