Modul:dara kategoriyan/rkatbike
Asayış
Seba na module şıma şenê yû pela dokumani vırazê Modul:dara kategoriyan/rkatbike/dok
-- [[Şablon:r]]
local export = {}
local b = require("Modul:bıngeh")
-- 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:languages").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 "çekuyan ra " or "") .. ret
end
function Category:getDataModule()
return "Modul:dara kategoriyan/rkatbike"
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 "Çekuyê ke " .. ret .. " ra ameyê " .. self._lang:getCanonicalName()
else
return "Çekuyê ke rêça cı " .. ret .. " ra ameya"
end
end
function Category:getDescription()
local ret = nil
if not self._lang then
if self._source:getType() == "family" then
return "Zıwanê ke zıwananê mıxtelifan ra " .. self._source:getCategoryName() .. " çekuyi gırewtê."
else
return "Zıwanê ke zıwanê ra " .. self._source:getCanonicalName() .. " çekuye gırewta."
end
else
if self._source:getType() == "family" then
return
"Çekuyê ke [[:Kategoriye:" .. mw.getContentLanguage():ucfirst(self._source:getCategoryName()) .. "|" .. self._source:getCategoryName() .. "]] ra "..
self._lang:getCanonicalName() .. " ameyê gırewtene.\n\n" ..
"Gani na kategoriye de tenya bınkategoriyi bıbên. Çımeyê çekuye ke rınd nêzaniyeno, gani tiya de meqale bıbo.\n\n" ..
"Eke zıwanê çımeyê na çekuye zaniyeno, keremê xo ra nê meqaleyi na pele ra wedarên."
elseif self._source:getType() == "etymology language" then
return "Çekuyê ke [[:Kategoriye:" .. self._source:getCategoryName() .. "|" .. b.lcfirst(self._source:getCategoryName()) .. "]] ra ".. self._lang:getCanonicalName() .." ameyê gırewtene."
else
return "Çekuyê ke [[:Kategoriye:" .. mw.getContentLanguage():ucfirst(self._source:getCategoryName()) .. "|" .. self._source:getCategoryName() .. "]] ra " .. self._lang:getCanonicalName() .. " ameyê gırewtene."
end
end
end
function Category:getParents()
local derived_from_subvariety_of_self = false
if self._lang then
local parent = {}
local pinfo = {
code = self._lang:getCode()
}
local sortkey = nil
if self._source:getType() == "family" then
pinfo.label = nil
sortkey = self._source:getCanonicalName()
elseif self._source:getType() == "etymology language" then
if self._source:getParentCode() == "qfa-iso" or self._source:getParentCode() == "qfa-not" or self._source:getParentCode() == "qfa-und" then
pinfo.label = nil
else
pinfo.label = self._source:getParentCode()
end
sortkey = self._source:getCanonicalName()
else
sortkey = self._source:getCanonicalName()
end
local additional_category = derived_from_subvariety_of_self and {
name = "Category:Categories for terms in a language derived from a term in a subvariety of that language",
sort = self._lang:getCanonicalName()
} or nil
if not pinfo.label then
return {
{
name = require("Modul:dara kategoriyan/pêrokatbike")
.new {
code = self._info.code,
label = "zıwananê binan ra"
},
sort = sortkey
},
additional_category,
}
else
return {{name = Category.new(pinfo), sort = sortkey}, additional_category}
end
else
-- if self._source:getType() == "family" then
-- return {{name = require("Modul:dara kategoriyan/malbatkatbike").new({code = self._info.label}), sort = " "}}
if self._source:getType() == "etymology language" then
return {{name = "Kategoriye:" .. mw.getContentLanguage():ucfirst(self._source:getCategoryName()), sort = "etimolociye"}}
else
return {{name = require("Modul:dara kategoriyan/zıwankatbike").new({code = self._info.label}), sort = "etimolociye"}}
end
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