Modul:dara kategoriyan/deynkirîkatbike
Documentation for this module may be created at Modul:dara kategoriyan/deynkirîkatbike/belge
local export = {}
local b = require("Module:bingeh")
-- Category object
local Category = {}
Category.__index = Category
function Category.new_main(frame)
local params = {
[1] = {},
[2] = {required = true},
}
args = require("Module:parameters").process(frame:getParent().args, params)
return Category.new({code = args[1], label = args[2]})
end
function Category.new(info)
for key, val in pairs(info) do
if not (key == "code" or key == "label") then
error("The parameter \"" .. key .. "\" was not recognized.")
end
end
local self = setmetatable({}, Category)
self._info = info
if not self._info.label then
error("No label was specified.")
end
self._lang = self._info.code and (require("Module:ziman").getByCode(self._info.code) or error("The language code \"" .. self._info.code .. "\" is not valid.")) or nil
self._source =
require("Module:families").getByCode(self._info.label) or
require("Module:etymology languages").getByCode(self._info.label) or
require("Module:languages").getByCode(self._info.label) or
error("\"" .. self._info.label .. "\" is not a valid language, family or etymology-only language code.")
return self
end
export.new = Category.new
export.new_main = Category.new_main
function Category:getInfo()
return self._info
end
function Category:getBreadcrumbName()
local ret = nil
if self._source:getType() == "family" then
ret = self._source:getCategoryName()
else
ret = self._source:getCanonicalName()
end
return (not self._lang and "deyn ji " or "") .. ret
end
function Category:getDataModule()
return "Modul:dara kategoriyan/deynkirîkatbike"
end
function Category:canBeEmpty()
return false
end
function Category:isHidden()
return false
end
function Category:getCategoryName()
local ret = nil
if self._source:getType() == "family" then
ret = self._source:getCategoryName()
else
if self._source:getCode() == "mul-tax" then
ret = "taxonomic names"
else
ret = self._source:getCanonicalName()
end
end
if self._lang then
return "Peyvên " .. self._lang:getCanonicalName() .. " yên deynkirî ji " .. ret
else
return "Peyvên deynkirî ji " .. ret
end
end
function Category:getDescription()
local ret = nil
if not self._lang then
if self._source:getType() == "family" then
return "Zimanên ku ji zimanên têvel yên " .. self._source:getCategoryName() .. " peyv wergirtine."
else
return "Zimanên ku ji zimanê " .. self._source:getCanonicalName() .. " peyv wergirtine."
end
else
if self._source:getType() == "family" then
return
"Peyvên " .. self._lang:getCanonicalName() .. " yên ku ji " ..
"[[:Kategorî:" .. mw.getContentLanguage():ucfirst(self._source:getCategoryName()) .. "|" .. self._source:getCategoryName() .. "]] hatine deynkirin.\n\n" ..
"Divê di vê kategoriyê de tenê binkategorî hebin. Dema jêdera peyvekê baş nayê zanîn, dibe ku li vir jî gotar hebin. " ..
"Heke zimanê jêder yê vê peyvê tê zanîn ji kerema xwe vê gotarê ji vê rûpelê rakin."
elseif self._source:getType() == "etymology language" then
return "Peyvên " .. self._lang:getCanonicalName() .. " yên ji [[:Kategorî:" .. mw.getContentLanguage():ucfirst(self._source:getCategoryName()) .. "|" .. b.lcfirst(self._source:getCategoryName()) .. "]] hatine deynkirin."
else
return "Peyvên " .. self._lang:getCanonicalName() .. " yên ji [[:Kategorî:" .. mw.getContentLanguage():ucfirst(self._source:getCategoryName()) .. "|" .. self._source:getCategoryName() .. "]] hatine deynkirin."
end
end
end
function Category:getParents()
local derived_from_subvariety_of_self = false
local sortkey = nil
if self._source:getType() == "family" then
sortkey = self._source:getCanonicalName()
else
sortkey = self._source:getCanonicalName()
end
if self._lang then
return {
{
name = require("Modul:dara kategoriyan/gelemperkatbike")
.new {
code = self._info.code,
label = "deynkirî ji zimanên din"
},
sort = sortkey,
},
{
name = require("Modul:dara kategoriyan/jikatbike")
.new {
code = self._info.code,
label = self._info.label
},
sort = " ",
}
}
else
return {
{
name = require("Modul:dara kategoriyan/jikatbike")
.new {
code = nil,
label = self._info.label
},
sort = " ",
}
}
end
end
function Category:getChildren()
return nil
end
function Category:getUmbrella()
if not self._lang then
return nil
end
return Category.new({label = self._source:getCode()})
end
return export