Jump to content

Module:mai-headword

From Wiktionary, the free dictionary


local export = {}
local pos_functions = {}
local links = require('Module:links')
local labels = require('Module:labels')

local lang = require('Module:languages').getByCode('mai')
local PAGENAME = mw.title.getCurrentTitle().text
local current_script = lang:findBestScript(PAGENAME)

function export.show(frame)
	local args = require('Module:parameters').process(frame:getParent().args,{
		['head'] = { list = true, default = PAGENAME },
		['tr'] = {}, -- just to prevent errors at the moment.
		['g'] = { list = true },
	})
	local poscat = frame.args[1] or error('Part of speech has not been specified. Please pass parameter 1 to the module invocation.')
	
	local data = {
		lang = lang,
		sc = current_script,
		pos_category = poscat,
		sccat = true,
		categories = {},
		heads = args['head'],
		genders = args.g,
		inflections = {},
	}
	
	if current_script:getCode() == 'Deva' then
		table.insert(data.inflections, {label = 'Tirhuta', require('Module:Deva-Tirh-translit').tr(head or PAGENAME, 'mai', 'Deva')})
	elseif current_script:getCode() == 'Tirh' then
		table.insert(data.inflections, {label = 'Devanagari', require('Module:Tirh-Deva-translit').tr(head or PAGENAME, 'mai', 'Tirh')})
	end
	return require('Module:headword').full_headword(data)
end

return export