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

--Mostly based on the nl-headword module, with some changes.

local export = {}
local pos_functions = {}

local lang = require("Module:languages").getByCode("stq")

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	PAGENAME = mw.title.getCurrentTitle().text
	
	--Part of speech.
	local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
	
	local params = {
		["head"] = {list = true},
	}
	
	if pos_functions[poscat] then
		for key, val in pairs(pos_functions[poscat].params) do
			params[key] = val
		end
	end
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local data = {lang = lang, pos_category = poscat, categories = {}, heads = args["head"], genders = {}, inflections = {}, tracking_categories = {}}
	
	if pos_functions[poscat] then
		pos_functions[poscat].func(args, data)
	end
	
	return require("Module:headword").full_headword(data) ..
		require("Module:utilities").format_categories(data.tracking_categories, lang, nil)
end

-- Display information for a noun's gender
-- This is separate so that it can also be used for proper nouns
function noun_gender(args, data)
	for _, g in ipairs(args[1]) do
		if g ~= "m" and g ~= "f" and g ~= "n" then
			g = nil
		end
		
		table.insert(data.genders, g)
	end
	
	if #data.genders == 0 then
		table.insert(data.genders, "?")
	end
end

-- Display proper noun
pos_functions["နာမ်မကိတ်ညဳ"] = {
	params = {
		[1] = {list = "g"},
		},
	func = function(args, data)
		noun_gender(args, data)
	end
}

-- Display information for a noun
pos_functions["နာမ်"] = {
	params = {
		[1] = {list = "g"},
		["g2"] = {list = true},
		[2] = {list = "pl"},
		
		["m"] = {list = true},
		["f"] = {list = true},
		},
	func = function(args, data)
		noun_gender(args, data)
		
		local plurals = args[2]
		
		local mascforms = args["m"]
		local femforms = args["f"]
		
		--Uncountable
		if plurals[1] == "-" then
			table.insert(data.inflections, {label = "တော်ဟွံမာန်"})
			table.insert(data.categories, "နာမ်သာဒလာန် ဖရေဝ်သဳယာန်မတော်ဟွံဂွံဂမၠိုင်")
		else
			-- Add the plural forms
			plurals.label = "ကိုန်ဗဟုဝစ်"
			plurals.accel = {form = "p"}
			plurals.request = true
			table.insert(data.inflections, plurals)
		end
		
		-- Add the feminine forms
		if #femforms > 0 then
			femforms.label = "ဣတ္တိလိင်"
			table.insert(data.inflections, femforms)
		end
		
		-- Add the masculine forms
		if #mascforms > 0 then
			mascforms.label = "ပုလ္လိၚ်"
			table.insert(data.inflections, mascforms)
		end
	end
}

return export