Jump to content

Module:uz-headword

From Wiktionary, the free dictionary

Used by {{uz-adj}}.


local export = {}

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

function export.adjectives(frame)
	local params = {
		head = {},
		[1] = {} -- intensive form
	}
	local args = require("Module:parameters").process(frame:getParent().args,
													  params)

	local lang = require("Module:languages").getByCode("uz")
	local title = mw.title.getCurrentTitle()
	local sc = lang:findBestScript(title.subpageText)
	local poscat = "adjectives"
	local positive_form = args.head or mw.title.getCurrentTitle().text
	local data = {
		lang = lang,
		pos_category = poscat,
		categories = {},
		heads = {positive_form},
		inflections = {}
	}

	if sc:getCode() == "Latn" then
		table.insert(data.inflections,
					 {label = "comparative", positive_form .. "roq"})
		table.insert(data.inflections,
					 {label = "superlative", "[[eng]] " .. positive_form})
		if args[1] then
			table.insert(data.inflections, {label = "intensive", args[1]})
		end
	elseif sc:getCode() == "Cyrl" then
		table.insert(data.inflections,
					 {label = "comparative", positive_form .. "роқ"})
		table.insert(data.inflections,
					 {label = "superlative", "[[энг]] " .. positive_form})
		if args[1] then
			table.insert(data.inflections, {label = "intensive", args[1]})
		end
	end

	return require("Module:headword").full_headword(data)
end

return export