Module:bho-headword


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

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

local Deva_Kthi_translit = require('Module:Deva-Kthi-translit')

function export.show(frame)
	local args = require('Module:parameters').process(frame:getParent().args,{
		['g'] = {default = '?'},
		['head'] = {},
	})
	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'] or PAGENAME}, genders = {}, inflections = {}}
	
	if poscat == 'nouns' or poscat == 'proper nouns' then
		if args['g'] == 'm' or args['g'] == 'f' then
			table.insert(data.genders, args['g'])
		else
			table.insert(data.genders, '?')
		end
	end
	
	if current_script:getCode() == 'Deva' then
		table.insert(data.inflections, {label = 'Kaithi', Deva_Kthi_translit.tr(head or PAGENAME, lang, require("Module:scripts").getByCode('Deva'))})
	end
	
	return require('Module:headword').full_headword(data)
end

return export