မော်ဂျူး: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, "list:", "")
	end
	
	local description
	local category = ""
	if lang then
		if matches == 1 then
			description =  "ဤသည်မှာ "  .. lang:getCanonicalName() .. " ဘာသာစကားရှိ  " .. listName .. "စာရင်းတစ်ခု ဖြစ်သည်။"
			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