local m_com = require("Module:User:Oyunqi/ug-common2")
local export = {}
-- local m_translit = require("Module:ug-translit")
local pos_functions = {}
-- local vowels = "اەېىوۇۆۈ"
local suff_plural = "لر"
local lang = require("Module:languages").getByCode("ug")
local function track(page)
-- require("Module:debug").track("ug-headword/" .. page)
-- return true
end
function export.make_plural_noun(singular, vv, change)
local base, v, c = m_com.getLast(singular)
if change == "yes" then
if vv ~= nil and vv ~= "" then
v = vv
else
if c == "" and (v == "ا" or v == "ە") then
v = "ى"
end
end
end
local term = base .. v .. c
local tongue = m_com.checkTongue(singular)
if tongue == "front" then
return term .. "لەر"
elseif tongue == "back" then
return term .. "لار"
end
return nil
end
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local poscat = frame.args or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local params = {
= {list = true, default = ""},
= {type = "boolean"},
}
if pos_functions then
for key, val in pairs(pos_functions.params) do
params = val
end
end
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {lang = lang, pos_category = poscat, categories = {}, heads = args, genders = {}, inflections = {enable_auto_translit = true}, categories = {}}
PAGENAME = mw.title.getCurrentTitle().subpageText
if args then
data.pos_category = "suffixes"
if poscat == "nouns" then
table.insert(data.categories, lang:getCanonicalName() .. " noun-forming suffixes")
else
error("No category exists for suffixes forming " .. poscat .. ".")
end
end
if pos_functions then
pos_functions.func(args, data)
end
return require("Module:headword").full_headword(data)
end
-- Display additional inflection information for a noun
pos_functions = {
params = {
= {}, -- Vowel, if there is a change
= {}, --plural override
= {}, -- yes or (else:no)
},
func = function(args, data)
local pl = args or nil
local change = args or "yes"
if pl == "-" then
table.insert(data.inflections, {label = "]"})
table.insert(data.categories, "Uyghur uncountable nouns")
else
if not pl then
local plural = export.make_plural_noun(PAGENAME, args, change)
if plural then
pl = plural
else
table.insert(data.categories, "Uyghur nouns with unpredictable plurals")
end
end
if pl then
local infl = {label = 'plural', {term=pl}}
table.insert(data.inflections, infl)
-- else
-- table.insert(data.categories, "Uyghur nouns needing plural inflection")
end
end
if pl and not mw.title.new(pl).exists then
table.insert(data.categories, "Missing Uyghur noun forms")
end
end
}
return export