Documentation for this module may be created at မဝ်ဂျူ:nn-adj-reg/doc

local export = {}

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

function export.main(frame)
	local word = mw.title.getCurrentTitle().text
	local args = frame:getParent().args
	local class = frame.args[1]  
	local length = word:len()
	
	local data = {lang = lang, pos_category = "နာမဝိသေသန", categories = {}, inflections = {}}
	
	local root = word
	local root2 = word
	
	if class == '1' then
		local root_n = mw.ustring.gsub(word, "kk$", "k")
		table.insert(data.inflections, { label = 'ပုလ္လိင်ကဵုဣတ္တိလိင်', root })
		table.insert(data.inflections, { label = 'နပုလ္လိင်', root_n .. 't' })
		table.insert(data.inflections, { label = 'ဨကန္တကိုန်ဨကဝုစ်ကဵုကိုန်ဗဟုဝစ်', root .. 'e' })
	elseif class == '2' then
		table.insert(data.inflections, { label = 'ကိုန်ဨကဝုစ်ဟွံကၠဳကၠး', word })
		table.insert(data.inflections, { label = 'ဨကန္တကိုန်ဨကဝုစ်ကဵုကိုန်ဗဟုဝစ်', root .. 'e' })
	elseif class == '3' then
		table.insert(data.inflections, { label = 'ကိုန်ဨကဝုစ်ကဵုကိုန်ဗဟုဝစ်', word })
	elseif class == '4' then
		root = word:sub(1, length-2)
		root2 = root .. 'n'

		table.insert(data.inflections, {label = 'ပုလ္လိင်ကဵုဣတ္တိလိင်', word})
		table.insert(data.inflections, {label = 'နပုလ္လိင်', root .. 'e',  root .. 'ent'})
		table.insert(data.inflections, {label = 'ဨကန္တကိုန်ဨကဝုစ်ကဵုကိုန်ဗဟုဝစ်', root .. 'ne'})
	elseif class == '4_2012' then
		root = word:sub(1, length-2)
		root2 = root .. 'n'

		table.insert(data.inflections, {label = 'ပုလ္လိင်', word})
		table.insert(data.inflections, {label = 'ဣတ္တိလိင်', word, root .. 'i'})
		table.insert(data.inflections, {label = 'နပုလ္လိင်', root .. 'e',  root .. 'i',  root .. 'ent'})
		table.insert(data.inflections, {label = 'ဨကန္တကိုန်ဨကဝုစ်ကဵုကိုန်ဗဟုဝစ်', root .. 'ne'})
	elseif class == '5' then
		root = word:sub(1, length-2)
		
		table.insert(data.inflections, { label = 'ပုလ္လိင်ကဵုဣတ္တိလိင်', word })
		
		if word:sub(-2) == 'en' then -- e.g. 'rettkomen'
			root2 = root .. 'n' -- for the superlatives
			table.insert(data.inflections, {label = 'နပုလ္လိင်', root .. 'e'})
			local root_dsg_pl = mw.ustring.gsub(root, "(.)%1$", "%1") -- rettkoMne (of [[rettkommen]])
			table.insert(data.inflections, {label = 'ဨကန္တကိုန်ဨကဝုစ်ကဵုကိုန်ဗဟုဝစ်', root_dsg_pl .. 'ne'})
		else
			root2 = word:sub(1, length-2) .. word:sub(-1)
			table.insert(data.inflections, {label = 'နပုလ္လိင်', word .. 't'})
			table.insert(data.inflections, {label = 'ဨကန္တကိုန်ဨကဝုစ်ကဵုကိုန်ဗဟုဝစ်', root2 .. 'e'})
		end
	end
	
	if args[1] == 'meir' or args[1] == 'more' or class == '3' then
		meir = true
	end
	
	if args[1] == 'non-comparable' or args[1] == 'non-comp' then
		meir = false
		non_comp = true
	end
	
	if meir then
		table.insert(data.inflections, { label = 'ပတုပ်ရံင်', '[[meir]] ' .. word })
		table.insert(data.inflections, { label = 'သဒ္ဒာ', '[[mest]] ' .. word })
	elseif not non_comp then
		table.insert(data.inflections, { label = 'ပတုပ်ရံင်', root2 .. 'are' })
		table.insert(data.inflections, { label = 'သဒ္ဒာဟွံကၠဳကၠး', root2 .. 'ast' })
		table.insert(data.inflections, { label = 'သဒ္ဒာဨကန္တ', root2 .. 'aste' })
	end

	return require('Module:headword').full_headword(data)
end
 
return export