မဝ်ဂျူ:list description

နူ ဝိက်ရှေန်နရဳ

Documentation for this module may be created at မဝ်ဂျူ:list description/doc

local export = {}

function export.show(frame)
	local title = mw.title.getCurrentTitle()
	local rootpagename = title.rootText
	local isSubpage = title.isSubpage
	local subpagename = title.subpageText
	mw.log(rootpagename, isSubpage, subpagename)
	
	local lang, canonicalName
	if isSubpage then
		lang = require("Module:languages").getByCode(subpagename)
	end
	
	local listName, matches
	if rootpagename then
		listName, matches = mw.ustring.gsub(rootpagename, "စရင်ဂမၠိုင်:", "")
	end
	
	local description
	local category = ""
	if lang then
		if matches == 1 then
			description =  "စရင်" .. listName .. "ဏအ်ဒှ်သွက်ဘာသာ" .. lang:getCanonicalName() .. " "
			if mw.ustring.match(listName, "အက္ခရ်လပ်တေန်") then
				category = "[[Category:ထာမ်ပလိက်အက္ခရ်လပ်တေန်ဂမၠိုင်]]"
			end
		else
			description = "စရင်ဏအ်ဒှ်သွက်ဘာသာ" .. lang:getCanonicalName()  .. " "
		end
	end
	
	if description then
		return description .. category
	end
end

return export