मॉड्यूल:category tree/poscatboiler/data/languages
दिखावट
"इस मॉड्यूल हेतु प्रलेख मॉड्यूल:category tree/poscatboiler/data/languages/doc पर बनाया जा सकता है"
local raw_categories = {}
local raw_handlers = {}
local m_languages = require("Module:languages")
local m_scripts = require("Module:scripts")
local m_table = require("Module:table")
-- This handles language categories of the form e.g. [[Category:French language]] and
-- [[:Category:British Sign Language]] and regional variant categories of the form
-- e.g. [[Category:Regional French]].
-----------------------------------------------------------------------------
-- --
-- RAW CATEGORIES --
-- --
-----------------------------------------------------------------------------
raw_categories["क्षेत्रीयताएँ"] = {
description = "श्रेणियाँ जो विविध भाषाओं के क्षेत्रीय रूपों के टर्म के लिए हैं",
additional = "{{{umbrella_msg}}}",
parents = {
"मूलभूत श्रेणी",
},
}
raw_categories["सभी भाषाएँ"] = {
intro = "{{sisterlinks|Category:Languages}}\n[[File:Languages world map-transparent background.svg|thumb|right|250px|Rough world map of language families]]",
description = "यह श्रेणी विक्षनरी पर मौज़ूद हर एक भाषा की श्रेणी को समाहित करती है।",
additional = "Not all languages that Wiktionary recognises may have a category here yet. There are many that have " ..
"not yet received any attention from editors, mainly because not all Wiktionary users know about every single " ..
"language. See [[Wiktionary:List of languages]] for a full list.",
parents = {
"मूलभूत श्रेणी",
},
}
raw_categories["सभी विलुप्त भाषाएँ"] = {
description = "This category contains the categories for every [[extinct language]] on Wiktionary.",
additional = "Do not confuse this category with [[:Category:Extinct languages]] which is for the names of extinct languages.",
parents = {
"सभी भाषाएँ",
},
}
-----------------------------------------------------------------------------
-- --
-- RAW HANDLERS --
-- --
-----------------------------------------------------------------------------
local function makeCategoryLink(object)
return "[[:श्रेणी:" .. object:getCategoryName() .. "|" .. object:getCanonicalName() .. "]]"
end
local function ucfirst(text)
return mw.getContentLanguage():ucfirst(text)
end
local function linkbox(lang, setwiki, setwikt, setsister, entryname)
local wiktionarylinks = "''मौज़ूद नहीं है।''"
local canonicalName = lang:getCanonicalName()
local wikimediaLanguages = lang:getWikimediaLanguages()
local nameWithLanguage = lang:getCategoryName("nocap")
local categoryName = lang:getCategoryName()
local wikipediaArticle = setwiki or lang:getWikipediaArticle()
setsister = setsister and ucfirst(setsister) or nil
if setwikt then
require "Module:debug".track "langcatboiler/setwikt"
if setwikt == "-" then
require "Module:debug".track "langcatboiler/setwikt/hyphen"
end
end
if setwikt ~= "-" and wikimediaLanguages and wikimediaLanguages[1] then
wiktionarylinks = {}
for _, wikimedialang in ipairs(wikimediaLanguages) do
table.insert(wiktionarylinks,
(wikimedialang:getCanonicalName() ~= canonicalName and "(''" .. wikimedialang:getCanonicalName() .. "'') " or "") ..
"'''[[:" .. wikimedialang:getCode() .. ":|" .. wikimedialang:getCode() .. ".wiktionary.org]]'''")
end
wiktionarylinks = table.concat(wiktionarylinks, "<br/>")
end
local plural = wikimediaLanguages[2] and "s" or ""
return table.concat{
[=[<div style="clear: right; border: solid #aaa 1px; margin: 1 1 1 1; background: #f9f9f9; width: 270px; padding: 5px; margin: 5px; text-align: left; float: right">
<div style="text-align: center; margin-bottom: 10px; margin-top: 5px">''']=], nameWithLanguage, [=['''</div>
{| style="font-size: 90%; background: #f9f9f9;"
|-
| style="vertical-align: middle; height: 35px; width: 35px;" | [[File:Wiktionary-logo-v2.svg|35px|none|विक्षनरी]]
|| '']=], nameWithLanguage, [=[ का]=], plural, [=[ विक्षनरी संस्करण''
|-
| colspan="2" style="padding-left: 10px; border-bottom: 1px solid lightgray;" | ]=], wiktionarylinks, [=[
|-
| style="vertical-align: middle; height: 35px" | [[File:Wikipedia-logo.png|35px|none|विकिपीडिया]]
|| '']=], nameWithLanguage, [=[ के बारे में विकिपीडिया लेख''
|-
| colspan="2" style="padding-left: 10px; border-bottom: 1px solid lightgray;" | ]=], (setwiki == "-" and "''कोई नहीं है।''" or "'''[[w:" .. wikipediaArticle .. "|" .. wikipediaArticle .. "]]'''"), [=[
|-
| style="vertical-align: middle; height: 35px" | [[File:Wikimedia-logo.svg|35px|none|विकिमीडिया कॉमंस]]
|| ''बंधु प्रकल्पों में ]=], nameWithLanguage, [=[ संबंधी विकिमीडिया कॉमंस कड़ियाँ''
|-
| colspan="2" style="padding-left: 10px; border-bottom: 1px solid lightgray;" | ]=], (setsister == "-" and "''मौज़ूद नहीं है।''" or "'''[[commons:Category:" .. (setsister or categoryName) .. "|" .. (setsister or categoryName) .. "]]'''"), [=[
|-
| style="vertical-align: middle; height: 35px" | [[File:Crystal kfind.png|35px|none|सावधानियाँ]]
|| ]=], nameWithLanguage, [=[ सावधानियाँ
|-
| colspan="2" style="padding-left: 10px; border-bottom: 1px solid lightgray;" | '''[[विक्षनरी:भाषा दिशानिर्देश:]=], canonicalName, [=[]]'''<br>'''[[:श्रेणी:]=], canonicalName, [=[ संदर्भ साँचे|संदर्भ साँचे]] ({{convert num en|{{PAGESINCAT:]=], canonicalName, [=[ संदर्भ साँचे}}}})'''
|-
| style="vertical-align: middle; height: 35px" | [[File:Open book nae 02.svg|35px|none|प्रविष्टि]]
|| ]=], nameWithLanguage, [=[ प्रविष्टि
|-
| colspan="2" style="padding-left: 10px;" | ''']=], require("Module:links").full_link({lang = m_languages.getByCode("en"), term = entryname or canonicalName}), [=['''
|}
</div>]=]
}
end
local function edit_link(title, text)
return '<span class="plainlinks">['
.. tostring(mw.uri.fullUrl(title, { action = "edit" }))
.. ' ' .. text .. ']</span>'
end
-- Should perhaps use wiki syntax.
local function infobox(lang)
local ret = {}
table.insert(ret, '<table class="wikitable language-category-info"')
if type(lang.getRawData) == "function" then
local raw_data = lang:getRawData()
if raw_data then
local replacements = {
[1] = "canonical-name",
[2] = "wikidata-item",
[3] = "family",
}
local function replacer(letter1, letter2)
return letter1:lower() .. "-" .. letter2:lower()
end
-- For each key in the language data modules, returns a descriptive
-- kebab-case version (containing ASCII lowercase words separated
-- by hyphens).
local function kebab_case(key)
key = replacements[key] or key
key = key:gsub("(%l)(%u)", replacer):gsub("(%l)_(%l)", replacer)
return key
end
local function html_attribute_encode(str)
str = mw.text.jsonEncode(str)
:gsub('"', """)
-- & in attributes is automatically escaped.
-- :gsub("&", "&")
:gsub("<", "<")
:gsub(">", ">")
return str
end
pcall(function ()
table.insert(ret, ' data-code="' .. lang:getCode() .. '"')
for k, v in m_table.sortedPairs(lang:getRawData()) do
table.insert(ret, " data-" .. kebab_case(k)
.. '="'
.. html_attribute_encode(v)
.. '"')
end
end)
end
end
table.insert(ret, '>\n')
table.insert(ret, '<tr class="language-category-data">\n<th colspan="2">'
.. edit_link("Module:" .. m_languages.getDataModuleName(lang:getCode()),
"भाषा आँकड़ा संपादन")
.. "</th>\n</tr>\n")
table.insert(ret, "<tr>\n<th>चलन का नाम</th><td>" .. lang:getCanonicalName() .. "</td>\n</tr>\n")
local otherNames = lang:getOtherNames(true)
if otherNames then
local names = {}
for _, name in ipairs(otherNames) do
table.insert(names, "<li>" .. name .. "</li>")
end
if #names > 0 then
table.insert(ret, "<tr>\n<th>अन्य नाम</th><td><ul>" .. table.concat(names, "\n") .. "</ul></td>\n</tr>\n")
end
end
local aliases = lang:getAliases()
if aliases then
local names = {}
for _, name in ipairs(aliases) do
table.insert(names, "<li>" .. name .. "</li>")
end
if #names > 0 then
table.insert(ret, "<tr>\n<th>पुकारनाम</th><td><ul>" .. table.concat(names, "\n") .. "</ul></td>\n</tr>\n")
end
end
local varieties = lang:getVarieties()
if varieties then
local names = {}
for _, name in ipairs(varieties) do
if type(name) == "string" then
table.insert(names, "<li>" .. name .. "</li>")
else
assert(type(name) == "table")
local first_var
local subvars = {}
for i, var in ipairs(name) do
if i == 1 then
first_var = var
else
table.insert(subvars, "<li>" .. var .. "</li>")
end
end
if #subvars > 0 then
table.insert(names, "<li><dl><dt>" .. first_var .. "</dt>\n<dd><ul>" .. table.concat(subvars, "\n") .. "</ul></dd></dl></li>")
elseif first_var then
table.insert(names, "<li>" .. first_var .. "</li>")
end
end
end
if #names > 0 then
table.insert(ret, "<tr>\n<th>वेरायटी</th><td><ul>" .. table.concat(names, "\n") .. "</ul></td>\n</tr>\n")
end
end
table.insert(ret, "<tr>\n<th>[[विक्षनरी:भाषाएँ|भाषा कोड]]</th><td><code>" .. lang:getCode() .. "</code></td>\n</tr>\n")
table.insert(ret, "<tr>\n<th>[[विक्षनरी:भाषा परिवार|भाषा परिवार]]</th>\n")
local fam = lang:getFamily()
local famCode = fam and fam:getCode()
if not fam then
table.insert(ret, "<td>अवर्गीकृत</td>")
elseif famCode == "qfa-iso" then
table.insert(ret, "<td>[[:श्रेणी:Language isolates|भाषा आइसोलेट]]</td>")
elseif famCode == "qfa-mix" then
table.insert(ret, "<td>[[:श्रेणी:Mixed languages|मिश्रित भाषा]]</td>")
elseif famCode == "sgn" then
table.insert(ret, "<td>[[:श्रेणी:Sign languages|sign language]]</td>")
elseif famCode == "crp" then
table.insert(ret, "<td>[[:श्रेणी:Creole or pidgin languages|creole or pidgin]]</td>")
elseif famCode == "art" then
table.insert(ret, "<td>[[:श्रेणी:Constructed languages|constructed language]]</td>")
else
table.insert(ret, "<td>" .. makeCategoryLink(fam) .. "</td>")
end
table.insert(ret, "\n</tr>\n<tr>\n<th>पूर्वज</th>\n")
local ancestors, ancestorChain = lang:getAncestors(), lang:getAncestorChain()
if ancestors[2] then
local ancestorList = {}
for i, anc in ipairs(ancestors) do
ancestorList[i] = "<li>" .. makeCategoryLink(anc) .. "</li>"
end
table.insert(ret, "<td><ul>\n" .. table.concat(ancestorList, "\n") .. "</ul></td>\n")
elseif ancestorChain[1] then
table.insert(ret, "<td><ul>\n")
local chain = {}
for i, anc in ipairs(ancestorChain) do
chain[i] = "<li>" .. makeCategoryLink(anc) .. "</li>"
end
table.insert(ret, table.concat(chain, "\n<ul>\n"))
for _, _ in ipairs(chain) do
table.insert(ret, "</ul>")
end
table.insert(ret, "</td>\n")
else
table.insert(ret, "<td>अज्ञात</td>\n")
end
table.insert(ret, "</tr>\n")
local scripts = lang:getScripts()
if scripts[1] then
local script_text = {}
local function makeScriptLine(sc)
local code = sc:getCode()
local url = tostring(mw.uri.fullUrl('Special:Search', {
search = 'contentmodel:css insource:"' .. code
.. '" insource:/\\.' .. code .. '/',
ns8 = '1'
}))
return makeCategoryLink(sc)
.. ' (<span class="plainlinks" title="Search for stylesheets referencing this script">[' .. url .. ' <code>' .. code .. '</code>]</span>)'
end
for _, sc in ipairs(scripts) do
local text = {}
local code = sc:getCode()
if code ~= "Hira" then
table.insert(text, "<li>" .. makeScriptLine(sc))
end
if code == "Jpan" then
local Hani = m_scripts.getByCode("Hani")
local Hira = m_scripts.getByCode("Hira")
local Kana = m_scripts.getByCode("Kana")
table.insert(text, "<ul>")
table.insert(text, "<li>" .. makeScriptLine(Hani) .. "</li>")
table.insert(text, "<li>" .. makeScriptLine(Hira) .. "</li>")
table.insert(text, "<li>" .. makeScriptLine(Kana) .. "</li>")
table.insert(text, "</ul>")
elseif code == "Kore" then
local Hang = m_scripts.getByCode("Hang")
local Hani = m_scripts.getByCode("Hani")
table.insert(text, "<ul>")
table.insert(text, "<li>" .. makeScriptLine(Hang) .. "</li>")
table.insert(text, "<li>" .. makeScriptLine(Hani) .. "</li>")
table.insert(text, "</ul>")
end
table.insert(text, "</li>")
table.insert(script_text, table.concat(text, "\n"))
end
table.insert(ret, "<tr>\n<th>[[विक्षनरी:लिपियाँ|लिपियाँ]]</th>\n<td><ul>\n" .. table.concat(script_text, "\n") .. "</ul></td>\n</tr>\n")
else
table.insert(ret, "<tr>\n<th>[[विक्षनरी:लिपियाँ|लिपियाँ]]</th>\n<td>नहीं दी गयीं</td>\n</tr>\n")
end
local function add_module_info(raw_data, heading)
if raw_data then
local scripts = lang:getScriptCodes()
local module_info, n, add = {}, 0, false
if type(raw_data) == "string" then
table.insert(module_info,
("[[Module:%s]]"):format(raw_data))
add = true
elseif type(raw_data) == "table" and m_table.size(scripts) == 1 and type(raw_data[scripts[1]]) == "string" then
table.insert(module_info,
("[[Module:%s]]"):format(raw_data[scripts[1]]))
add = true
elseif type(raw_data) == "table" then
table.insert(module_info, "<ul>")
for script, data in m_table.sortedPairs(raw_data) do
local script_info
if m_scripts.getByCode(script) then
if type(data) == "string" then
script_info = ("[[Module:%s]]</li>"):format(data)
else
n = n + 1
script_info = "(none)\n"
end
table.insert(module_info, ("<li><code>%s</code>: %s"):format(script, script_info))
end
end
table.insert(module_info, "</ul>")
if m_table.size(module_info) > 2 and n < (m_table.size(module_info) - 2) then add = true end
end
if add then
table.insert(ret, [=[
<tr>
<th>]=] .. heading .. [=[</th>
<td>]=] .. table.concat(module_info) .. [=[</td>
</tr>
]=])
end
end
end
add_module_info(lang._rawData.generate_forms, "Form-generating<br>module")
add_module_info(lang._rawData.translit, "[[Wiktionary:Transliteration and romanization|Transliteration<br>module]]")
add_module_info(lang._rawData.display_text, "Display text<br>module")
add_module_info(lang._rawData.entry_name, "Entry name<br>module")
add_module_info(lang._rawData.sort_key, "[[sortkey|Sortkey]]<br>module")
local wikidataItem = lang:getWikidataItem()
if lang:getWikidataItem() and mw.wikibase then
local URL = mw.wikibase.getEntityUrl(wikidataItem)
local link
if URL then
link = '[' .. URL .. ' ' .. wikidataItem .. ']'
else
link = '<span class="error">अवैध विकिडेटा आइटम: <code>' .. wikidataItem .. '</code></span>'
end
table.insert(ret, "<tr><th>विकिडेटा</th><td>" .. link .. "</td></tr>")
end
table.insert(ret, "</table>")
return table.concat(ret)
end
local function NavFrame(content, title)
return '<div class="NavFrame"><div class="NavHead">'
.. (title or '{{{title}}}') .. '</div>'
.. '<div class="NavContent" style="text-align: left;">'
.. content
.. '</div></div>'
end
local function get_description_intro_additional(lang, countries, extinct, setwiki, setwikt, setsister, entryname)
local nameWithLanguage = lang:getCategoryName("nocap")
if lang:getCode() == "und" then
local description =
"This is the main category of the '''" .. nameWithLanguage .. "''', represented in Wiktionary by the [[Wiktionary:Languages|code]] '''" .. lang:getCode() .. "'''. " ..
"This language contains terms in historical writing, whose meaning has not yet been determined by scholars."
return description, nil, nil
end
local canonicalName = lang:getCanonicalName()
local intro = linkbox(lang, setwiki, setwikt, setsister, entryname)
local the_prefix
if canonicalName:find(" Language$") then
the_prefix = ""
else
the_prefix = ""
end
local description = "यह " .. the_prefix .. "'''" .. nameWithLanguage .. "''' के लिए मुख्य श्रेणी है।"
local country_links = {}
for _, country in ipairs(countries) do
if country ~= "UNKNOWN" then
local country_without_the = country:match("^the (.*)$")
if country_without_the then
table.insert(country_links, "[[" .. country_without_the .. "]]")
else
table.insert(country_links, "[[" .. country .. "]]")
end
end
end
local country_desc
if #country_links > 0 then
local country_link_text = m_table.serialCommaJoin(country_links)
if extinct then
country_desc = "It is an [[extinct language]] that was formerly spoken in " .. country_link_text .. ".\n\n"
else
country_desc = "यह " .. country_link_text .. " में बोली जाती है।\n\n"
end
elseif extinct then
country_desc = "It is an [[extinct language]]."
else
country_desc = ""
end
local add = country_desc .. "" .. canonicalName .. " के बारे में जानकारी:\n\n" .. infobox(lang)
if lang:hasType("reconstructed") then
add = add .. "\n\n" ..
ucfirst(canonicalName) .. " is a reconstructed language. Its words and roots are not directly attested in any written works, but have been reconstructed through the ''comparative method'', " ..
"which finds regular similarities between languages that cannot be explained by coincidence or word-borrowing, and extrapolates ancient forms from these similarities.\n\n" ..
"According to our [[Wiktionary:Criteria for inclusion|criteria for inclusion]], terms in " .. canonicalName ..
" should '''not''' be present in entries in the main namespace, but may be added to the Reconstruction: namespace."
elseif lang:hasType("appendix-constructed") then
add = add .. "\n\n" ..
ucfirst(canonicalName) .. " is a constructed language that is only in sporadic use. " ..
"According to our [[Wiktionary:Criteria for inclusion|criteria for inclusion]], terms in " .. canonicalName ..
" should '''not''' be present in entries in the main namespace, but may be added to the Appendix: namespace. " ..
"All terms in this language may be available at [[Appendix:" .. ucfirst(canonicalName) .. "]]."
end
local about = mw.title.new("विक्षनरी:" .. canonicalName .. "के बारे में")
if about.exists then
add = add .. "\n\n" ..
"कृपया '''[[विक्षनरी:" .. canonicalName .. " के बारे में]]''' देखें अगर आपको अधिक जानकारी चाहिए और " .. nameWithLanguage .. " की प्रविष्टियाँ जोड़ने के बारे में विशेष सावधानियाँ जाननीं वांछित है।"
end
local ok, tree_of_descendants = pcall(
require("Module:family tree").print_children,
lang:getCode(), {
protolanguage_under_family = true,
must_have_descendants = true
})
if ok then
if tree_of_descendants then
add = add .. NavFrame(
tree_of_descendants,
"परिवार वृक्ष")
else
add = add .. "\n\n" .. ucfirst(lang:getCanonicalName())
.. " has no descendants or varieties listed in Wiktionary's language data modules."
end
else
mw.log("error while generating tree: " .. tostring(tree_of_descendants))
end
return description, intro, add
end
local function get_parents(lang, countries, extinct)
local canonicalName = lang:getCanonicalName()
local ret = {{name = "सभी भाषाएँ", sort = canonicalName}}
local fam = lang:getFamily()
local famCode = fam and fam:getCode()
-- FIXME: Some of the following categories should be added to this module.
if not fam then
table.insert(ret, {name = "श्रेणी:Unclassified languages", sort = canonicalName})
elseif famCode == "qfa-iso" then
table.insert(ret, {name = "श्रेणी:Language isolates", sort = canonicalName})
elseif famCode == "qfa-mix" then
table.insert(ret, {name = "श्रेणी:Mixed languages", sort = canonicalName})
elseif famCode == "sgn" then
table.insert(ret, {name = "श्रेणी:All sign languages", sort = canonicalName})
elseif famCode == "crp" then
table.insert(ret, {name = "श्रेणी:Creole or pidgin languages", sort = canonicalName})
for _, anc in ipairs(lang:getAncestors()) do
-- Avoid Haitian Creole being categorised in [[:Category:Haitian Creole-based creole or pidgin languages]], as one of its ancestors is an etymology-only variety of it.
-- Use that ancestor's ancestors instead.
if anc:getNonEtymologicalCode() == lang:getCode() then
for _, anc_extra in ipairs(anc:getAncestors()) do
table.insert(ret, {name = "श्रेणी:" .. ucfirst(anc_extra:getNonEtymologicalName()) .. "-based creole or pidgin languages", sort = canonicalName})
end
else
table.insert(ret, {name = "श्रेणी:" .. ucfirst(anc:getNonEtymologicalName()) .. "-based creole or pidgin languages", sort = canonicalName})
end
end
elseif famCode == "art" then
if lang:hasType("appendix-constructed") then
table.insert(ret, {name = "श्रेणी:Appendix-only constructed languages", sort = canonicalName})
else
table.insert(ret, {name = "श्रेणी:Constructed languages", sort = canonicalName})
end
for _, anc in ipairs(lang:getAncestors()) do
if anc:getNonEtymologicalCode() == lang:getCode() then
for _, anc_extra in ipairs(anc:getAncestors()) do
table.insert(ret, {name = "श्रेणी:" .. ucfirst(anc_extra:getNonEtymologicalName()) .. "-based constructed languages", sort = canonicalName})
end
else
table.insert(ret, {name = "श्रेणी:" .. ucfirst(anc:getNonEtymologicalName()) .. "-based constructed languages", sort = canonicalName})
end
end
else
table.insert(ret, {name = "श्रेणी:" .. fam:getCategoryName(), sort = canonicalName})
if lang:hasType("reconstructed") then
table.insert(ret, {name = "श्रेणी:Reconstructed languages", sort = (mw.ustring.gsub(canonicalName, "^प्रोटो%-", ""))})
end
end
for _, sc in ipairs(lang:getScripts()) do
table.insert(ret, {name = "श्रेणी:" .. sc:getCategoryName() .. " भाषाएँ", sort = canonicalName})
if sc:getCode() == "Jpan" then
table.insert(ret, {name = "श्रेणी:" .. m_scripts.getByCode("Hani"):getCategoryName() .. " भाषाएँ", sort = canonicalName})
table.insert(ret, {name = "श्रेणी:" .. m_scripts.getByCode("Hira"):getCategoryName() .. " भाषाएँ", sort = canonicalName})
table.insert(ret, {name = "श्रेणी:" .. m_scripts.getByCode("Kana"):getCategoryName() .. " भाषाएँ", sort = canonicalName})
elseif sc:getCode() == "Kore" then
table.insert(ret, {name = "श्रेणी:" .. m_scripts.getByCode("Hang"):getCategoryName() .. " भाषाएँ", sort = canonicalName})
table.insert(ret, {name = "श्रेणी:" .. m_scripts.getByCode("Hani"):getCategoryName() .. " भाषाएँ", sort = canonicalName})
end
end
if lang:hasTranslit() then
table.insert(ret, {name = "श्रेणी:Languages with automatic transliteration", sort = canonicalName})
end
local saw_country = false
for _, country in ipairs(countries) do
if country ~= "UNKNOWN" then
table.insert(ret, "श्रेणी:" .. country .." की भाषाएँ")
saw_country = true
end
end
if extinct then
table.insert(ret, {name = "All extinct languages", sort = canonicalName})
end
if not saw_country then
table.insert(ret, "श्रेणी:Languages not sorted into a country category")
end
return ret
end
local function get_children(lang)
local ret = {}
-- FIXME: We should work on the children mechanism so it isn't necessary to manually specify these.
for _, label in ipairs({"परिशिष्ट", "प्रविष्टि रखरखाव", "लेम्मा", "नाम", "phrases", "तुक", "symbols", "साँचे", "terms by etymology", "terms by usage"}) do
table.insert(ret, {name = label, is_label = true})
end
table.insert(ret, {name = "terms derived from {{{langname}}}", is_label = true, lang = false})
table.insert(ret, {module = "topic cat", args = {code = "{{{langcode}}}", label = "सभी विषय"}, sort = "सभी विषय"})
table.insert(ret, {name = "क्षेत्रीय {{{langname}}}"})
table.insert(ret, {name = "{{{langname}}} हेतु अनुरोध"})
table.insert(ret, {name = "श्रेणी:तुक:{{{langname}}}", description = "तुकांत {{{langname}}} शब्दों की सूची"})
table.insert(ret, {name = "श्रेणी:सदस्य {{{langcode}}}", description = "विक्षनरी सदस्य {{{langname}}} में दक्षता के अनुसार।"})
return ret
end
-- Handle language categories of the form e.g. [[:Category:French language]] and
-- [[:Category:British Sign Language]].
table.insert(raw_handlers, function(data)
local lang
local langname = data.category:match("^(.*) भाषा$")
if langname then
lang = m_languages.getByCanonicalName(langname)
elseif data.category:find(" Language$") then
lang = m_languages.getByCanonicalName(data.category)
end
if not lang then
return nil
end
local params = {
[4] = {list = true},
["setwiki"] = {},
["setwikt"] = {},
["setsister"] = {},
["entryname"] = {},
["extinct"] = {type = "boolean"},
}
local args = require("Module:parameters").process(data.args, params)
-- If called from inside, don't require any arguments, as they can't be known
-- in general and aren't needed just to generate the first parent (used for
-- breadcrumbs).
if #args[4] == 0 and not data.called_from_inside then
-- At least one country must be specified unless the language is constructed (e.g. Esperanto) or reconstructed (e.g. Proto-Indo-European).
local fam = lang:getFamily()
if not (lang:hasType("reconstructed") or (fam and fam:getCode() == "art")) then
error("At least one country (param 1=) must be specified for language '" .. lang:getCanonicalName() .. "' (code '" .. lang:getCode() .. "'). " ..
"Use the value UNKNOWN if the language's location is truly unknown.")
end
end
local description, intro, additional = "", "", ""
-- If called from inside the category tree system, it's called when generating
-- parents or children, and we don't need to generate the description or additional
-- text (which is very expensive in terms of memory because it calls [[Module:family tree]],
-- which calls [[Module:languages/data/all]]).
if not data.called_from_inside then
description, intro, additional = get_description_intro_additional(
lang, args[4], args.extinct, args.setwiki, args.setwikt, args.setsister, args.entryname
)
end
return {
description = description,
lang = lang:getCode(),
intro = intro,
additional = additional,
breadcrumb = lang:getCanonicalName(),
parents = get_parents(lang, args[4], args.extinct),
extra_children = get_children(lang),
umbrella = false,
can_be_empty = true,
}, true
end)
-- Handle categories such as [[:Category:Regional French]] and [[:Category:Regional Ancient Greek]].
table.insert(raw_handlers, function(data)
local langname = data.category:match("^क्षेत्रीय (.*)$")
if langname then
local lang = require("Module:languages").getByCanonicalName(langname)
if lang then
return {
lang = lang:getCode(),
description = "Categories containing terms in regional varieties of " .. lang:makeCategoryLink() .. ".",
additional = "This category may also directly contain terms that are uncategorized regionalisms. Such terms should usually be recategorized by the particular regional variety they belong to.",
parents = {
"{{{langcat}}}",
{name = "क्षेत्रीयताएँ", sort = langname},
},
breadcrumb = "क्षेत्रीय",
}
end
end
end)
-- Handle categories such as [[:Category:English-based creole or pidgin languages]].
table.insert(raw_handlers, function(data)
local langname = data.category:match("(.*)%-based creole or pidgin languages$")
if langname then
local lang = require("Module:languages").getByCanonicalName(langname)
if lang then
return {
lang = lang:getCode(),
description = "Languages which developed as a [[creole]] or [[pidgin]] from " .. lang:makeCategoryLink() .. ".",
parents = {{name = "Creole or pidgin languages", sort = "*" .. langname}},
breadcrumb = lang:getCanonicalName() .. "-based",
}
end
end
end)
-- Handle categories such as [[:Category:English-based constructed languages]].
table.insert(raw_handlers, function(data)
local langname = data.category:match("(.*)%-based constructed languages$")
if langname then
local lang = require("Module:languages").getByCanonicalName(langname)
if lang then
return {
lang = lang:getCode(),
description = "Constructed languages which are based on " .. lang:makeCategoryLink() .. ".",
parents = {{name = "Constructed languages", sort = "*" .. langname}},
breadcrumb = lang:getCanonicalName() .. "-based",
}
end
end
end)
return {RAW_CATEGORIES = raw_categories, RAW_HANDLERS = raw_handlers}