မဝ်ဂျူ:th-hom

နူ ဝိက်ရှေန်နရဳ
ထာမ်ပလိက်တဏအ်ဒးနွံကဵုလိက်စၟတ်သမ္တီမချူလဝ်သာဓက။
သ္ပဂုန်တုဲထာမ်ပလိက်တဏအ်ဒးစၟတ်သမ္တီကဵုလိက်မချူလဝ်နူကဵုဓမံက်ထ္ၜးကဵုဗီုပြၚ်ကိစ္စမရန်တၟအ်လဝ် ကဵု ပရေၚ်မရပ်စပ်လ္တူမုက်လိက်နကဵုလိက်စၟတ်သမ္တီမချူလဝ်သာဓက

local export = {}
local lang = require("Module:languages").getByCode("th")
local PAGENAME = mw.title.getCurrentTitle().text

local function getHomophones(reading)
	
	return require('Module:th-hom/data')[reading] or {}
	
end

-- can be called from another module
function export.makeList(reading)
	
	local result = {}
	local categories = {}
	
	local homList = getHomophones(reading)
	if #homList > 1 then
		for _,term in ipairs(homList) do
			-- skip if same word
			if term ~= PAGENAME then
				table.insert(result, require('Module:links').full_link({lang = lang, term = term, tr = '-'}))
			end
		end
		if mw.title.getCurrentTitle().namespace == 0 then
			
		end
	end
	
	return table.concat(result, ', ')
		.. require('Module:utilities').format_categories(categories, lang)
	
end

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

return export