Wiksiyonaryo tlwiktionary https://tl.wiktionary.org/wiki/Wiksiyonaryo:Unang_Pahina MediaWiki 1.46.0-wmf.24 case-sensitive Midya Natatangi Usapan Tagagamit Usapang tagagamit Wiksiyonaryo Usapang Wiksiyonaryo Talaksan Usapang talaksan MediaWiki Usapang MediaWiki Padron Usapang padron Tulong Usapang tulong Kategorya Usapang kategorya TimedText TimedText talk Module Module talk Event Event talk alinsunod 0 3223 176607 159979 2026-04-23T13:47:40Z Hiyuune 5522 Inilipat ni Hiyuune ang pahinang [[Alinsunod]] sa [[alinsunod]] 159979 wikitext text/x-wiki "ALINSUNOD" Ang mataas na patakaran na sinusunod dahil sa katuwiran nito.Pambihira na sa kasalukuyang tagalog dahil sa kawalan ng kamalayan sa moralidad at mabuting katuwiran o pakundangan.Halimbawa ng gamit= 1.) Kapag dumarami ang mga tao ay dapat paramihin din ang bilang nga punong kahoy alinsunod sa patakaran o batas ng ekolohiya ng ating kapaligiran. 5d15qbmk9ursb02rhs14hpuf9ik68mb 176609 176607 2026-04-23T13:52:15Z Hiyuune 5522 176609 wikitext text/x-wiki ==Tagalog== ===Pagbigkas=== {{tl-pr|+,alinsunód}} ===Pang-uri=== {{tl-adj|+,alinsunód|b=+}} # {{rfdef|tl}} ====Katawagang hinango==== {{col3|tl|umalinsunod|maalinsunod|ialinsunod|alinsunurin|alinsunuran|alinsunod sa|alinsunod kay|pag-alinsunuran}} ====Tingnan din==== {{col3|tl|alin|sunod}} ===Basahin pa=== * {{R:KWF Diksiyonaryo}} * {{R:Pambansang Diksiyonaryo}} 2z4g89i4ihzaz5d9htn9z9erg3k7we1 176613 176609 2026-04-23T13:58:18Z Hiyuune 5522 176613 wikitext text/x-wiki =={{=tl=}}== ===Pagbigkas=== {{tl-pr|+,alinsunód}} ===Pang-uri=== {{tl-adj|+,alinsunód|b=+}} # {{rfdef|tl}} ====Katawagang hinango==== {{col3|tl|umalinsunod|maalinsunod|ialinsunod|alinsunurin|alinsunuran|alinsunod sa|alinsunod kay|pag-alinsunuran}} ====Tingnan din==== {{col3|tl|alin|sunod}} ===Basahin pa=== * {{R:KWF Diksiyonaryo}} * {{R:Pambansang Diksiyonaryo}} ntis408074o8c0m3nloezbwoqx6xiaq Banahaw 0 27514 176611 74614 2026-04-23T13:56:00Z Hiyuune 5522 176611 wikitext text/x-wiki ==Ingles== ===Pangngalang pantangi=== {{en-prop}} # {{place|en|barangay|mun/Santa Cruz|p/Marinduque|c/Philippines}}. nux0xzw2fmwje7111hwek7u0chojt5q 176612 176611 2026-04-23T13:57:12Z Hiyuune 5522 /* Ingles */ 176612 wikitext text/x-wiki =={{=en=}}== ===Pangngalang pantangi=== {{en-prop}} # {{place|en|barangay|mun/Santa Cruz|p/Marinduque|c/Philippines}}. enw12cmobkm2polqe9lo6tmh99hlh97 Module:rhymes 828 31194 176614 165467 2026-04-24T08:01:27Z Yivan000 4078 enwikt parity 176614 Scribunto text/plain local export = {} local force_cat = false -- for testing local rhymes_styles_css_module = "Module:rhymes/styles.css" local IPA_module = "Module:IPA" local parameters_module = "Module:parameters" local parameter_utilities_module = "Module:parameter utilities" local pron_qualifier_module = "Module:pron qualifier" local script_utilities_module = "Module:script utilities" local string_utilities_module = "Module:string utilities" local TemplateStyles_module = "Module:TemplateStyles" local utilities_module = "Module:utilities" local concat = table.concat local insert = table.insert local function rsplit(text, pattern) return require(string_utilities_module).split(text, pattern) end local function track(page) require("Module:debug/track")("rhymes/" .. page) return true end local function tag_rhyme(rhyme, lang) local formatted_rhyme, cats, err formatted_rhyme, cats, err = require(IPA_module).format_IPA(lang, rhyme, "raw") return formatted_rhyme, cats, err end local function make_rhyme_link(lang, link_rhyme, display_rhyme) local retval, cats if not link_rhyme then retval = concat{"[[Rhymes:", lang:getCanonicalName(), "|", lang:getCanonicalName(), "]]"} cats = {} else local formatted_rhyme formatted_rhyme, cats, err = tag_rhyme(display_rhyme or link_rhyme, lang) retval = concat{"[[Rhymes:", lang:getCanonicalName(), "/", link_rhyme, "|", formatted_rhyme, "]]", err} end return retval, cats end --[==[ Implementation of {{tl|rhymes row}}. ]==] function export.show_row(frame) local args = require(parameters_module).process( frame.getParent and frame:getParent().args or frame, { [1] = {required = true, type = "full language"}, [2] = {required = true}, [3] = {}, } ) if not args[1] then return "[[Rhymes:English/aɪmz|<span class=\"IPA\">-aɪmz</span>]]" end -- Discard cleanup categories from make_rhyme_link(). return (make_rhyme_link(args[1], args[2], "-" .. args[2])) .. (args[3] and (" (''" .. args[3] .. "'')") or "") end do local function add_syllable_categories(categories, lang, rhyme, num_syl) local prefix = "Rhymes:" .. lang .. "/" .. rhyme insert(categories, prefix) if num_syl then for _, n in ipairs(num_syl) do local c if n > 1 then c = prefix .. "/" .. n .. " syllables" else c = prefix .. "/1 syllable" end insert(categories, c) end end end --[==[ Meant to be called from a module. `data` is a table containing the following fields: * `lang`: language object for the rhymes; * `rhymes`: a list of rhymes, each described by an object which specifies the rhyme, optional number of syllables, and optional left and right regular and accent qualifier fields: ** `rhyme`: the rhyme itself; ** `num_syl`: {nil} or a list of numbers, specifying the number of syllables of the word with this rhyme; optional and currently used only for categorization; if omitted, defaults to the top-level `num_syl`; ** `separator`: {nil} or the string used to separate this rhyme from the preceding one when displayed; defaults to the top-level `separator`; ** `q`: {nil} or a list of left regular qualifier strings, formatted using {format_qualifier()} in [[Module:qualifier]] and displayed directly before the rhyme in question; ** `qq`: {nil} or a list of right regular qualifier strings, displayed directly after the rhyme in question; ** `qualifiers`: {nil} or a list of qualifier strings; also displayed on the left; for compatibility purposes only, do not use in new code; ** `a`: {nil} or a list of left accent qualifier strings, formatted using {format_qualifiers()} in [[Module:accent qualifier]] and displayed directly before the rhyme in question; ** `aa`: {nil} or a list of right accent qualifier strings, displayed directly after the rhyme in question; ** `refs`: {nil} or a list of references or reference specs to add directly after the rhyme; the value of a list item is either a string containing the reference text (typically a call to a citation template such as {{tl|cite-book}}, or a template wrapping such a call), or an object with fields `text` (the reference text), `name` (the name of the reference, as in {{cd|<nowiki><ref name="foo">...</ref></nowiki>}} or {{cd|<nowiki><ref name="foo" /></nowiki>}}) and/or `group` (the group of the reference, as in {{cd|<nowiki><ref name="foo" group="bar">...</ref></nowiki>}} or {{cd|<nowiki><ref name="foo" group="bar"/></nowiki>}}); this uses a parser function to format the reference appropriately and insert a footnote number that hyperlinks to the actual reference, located in the {{cd|<nowiki><references /></nowiki>}} section; ** `nocat`: if {true}, suppress categorization for this rhyme only; * `num_syl`: {nil} or a list of numbers, specifying the number of syllables for all rhymes; optional and currently used only for categorization; overridable at the individual rhyme level; * `separator`: {nil} or a string, specifying the separator displayed before all rhymes but the first; by default, {", "}; overridable at the individual rhyme level; * `q`: {nil} or a list of left regular qualifier strings, formatted using {format_qualifier()} in [[Module:qualifier]] and displayed before the initial caption; * `qq`: {nil} or a list of right regular qualifier strings, displayed after all rhymes; * `qualifiers`: {nil} or a list of left regular qualifier strings; for compatibility purposes only, do not use in new code; * `a`: {nil} or a list of left accent qualifier strings, formatted using {format_qualifiers()} in [[Module:accent qualifier]] and dispalyed before the initial caption; * `aa`: {nil} or a list of right accent qualifier strings, displayed after all rhymes; * `sort`: {nil} or sort key; * `caption`: {nil} or string specifying the caption to use, in place of {"Rhymes"}; a colon and space is automatically added after the caption; * `nocaption`: if {true}, suppress the caption display; * `nocat`: if {true}, suppress categorization; * `force_cat`: if {true}, force categorization even on non-mainspace pages. If both regular and accent qualifiers on the same side and at the same level are specified, the accent qualifiers precede the regular qualifiers on both left and right. '''WARNING''': Destructively modifies the objects inside the `rhymes` field. Note that the number of syllables is currently used only for categorization; if present, an extra category will be added such as [[:Category:Rhymes:Italian/ino/3 syllables]] in addition to [[:Category:Rhymes:Italian/ino]]. ]==] function export.format_rhymes(data) local langname = data.lang:getFullName() local parts = {} local categories = {} local overall_sep = data.separator or ", " for i, r in ipairs(data.rhymes) do local rhyme = r.rhyme local link, link_cats = make_rhyme_link(data.lang, rhyme, "-" .. rhyme) if not r.nocat and not data.nocat then for _, cat in ipairs(link_cats) do insert(categories, cat) end end if r.qualifiers then track("old-qualifiers") end if r.q and r.q[1] or r.qq and r.qq[1] or r.qualifiers and r.qualifiers[1] or r.a and r.a[1] or r.aa and r.aa[1] or r.refs and r.refs[1] then link = require(pron_qualifier_module).format_qualifiers { lang = data.lang, text = link, q = r.q, qq = r.qq, qualifiers = r.qualifiers, a = r.a, aa = r.aa, refs = r.refs, } end insert(parts, r.separator or i > 1 and overall_sep or "") insert(parts, link) if not r.nocat and not data.nocat then add_syllable_categories(categories, langname, rhyme, r.num_syl or data.num_syl) end end local text = concat(parts) if not data.nocaption then text = (data.caption or "Rhymes") .. ": " .. text end if data.q and data.q[1] or data.qq and data.qq[1] or data.a and data.a[1] or data.aa and data.aa[1] then text = require(pron_qualifier_module).format_qualifiers { lang = data.lang, text = text, q = data.q, qq = data.qq, a = data.a, aa = data.aa, } end if categories[1] then local categories = require(utilities_module).format_categories(categories, data.lang, data.sort, nil, force_cat or data.force_cat) text = text .. categories end return text end end --[==[ Implementation of {{tl|rhymes}}. ]==] function export.show(frame) local parent_args = frame:getParent().args local compat = parent_args.lang local offset = compat and 0 or 1 local lang_param = compat and "lang" or 1 local plain = {} local boolean = {type = "boolean"} local params = { [lang_param] = {required = true, type = "language", default = "en"}, [1 + offset] = {list = true, required = true, disallow_holes = true, default = "aɪmz"}, ["caption"] = plain, ["nocaption"] = boolean, ["nocat"] = boolean, ["sort"] = plain, } local m_param_utils = require(parameter_utilities_module) local param_mods = m_param_utils.construct_param_mods { { param = "s", item_dest = "num_syl", separate_no_index = true, type = "number", sublist = true, }, {group = {"q", "a", "ref"}}, } local rhymes, args = m_param_utils.parse_list_with_inline_modifiers_and_separate_params { params = params, param_mods = param_mods, raw_args = parent_args, termarg = 1 + offset, term_dest = "rhyme", track_module = "rhymes", } local lang = args[lang_param] local data = { lang = lang, rhymes = rhymes, num_syl = args.s.default, caption = args.caption, nocaption = args.nocaption, nocat = args.nocat, sort = args.sort, q = args.q.default, qq = args.qq.default, a = args.a.default, aa = args.aa.default, } return export.format_rhymes(data) end --[==[ Implementation of {{tl|rhymes nav}}. ]==] function export.show_nav(frame) local args = require(parameters_module).process( frame:getParent().args, { [1] = {required = true, type = "full language", default = "und"}, [2] = {list = true, allow_holes = true}, ["nocat"] = {type = "boolean"}, } ) local lang = args[1] local langname = lang:getCanonicalName() local parts = args[2] -- Create steps -- FIXME: We should probably use format_categories() in [[Module:utilities]] rather than constructing categories -- manually. local categories = {} -- Here and below, we ignore any cleanup categories coming out of make_rhyme_link() by adding an extra set of parens -- around the call to make_rhyme_link() to cause the second argument (the categories) to be ignored. {{rhymes nav}} -- is run on a rhymes page so it's not clear we want the page to be added to any such categories, if they exist. local steps = {"[[Wiktionary:Rhymes|Rhymes]]", (make_rhyme_link(lang))} if #parts > 0 then local last = parts[#parts] parts[#parts] = nil local prefix = "" for i, part in ipairs(parts) do prefix = prefix .. part parts[i] = prefix end for _, part in ipairs(parts) do insert(steps, (make_rhyme_link(lang, part .. "-", "-" .. part .. "-"))) end if last == "-" then insert(steps, (make_rhyme_link(lang, prefix, "-" .. prefix))) insert(categories, "[[Category:" .. langname .. " rhymes" .. (prefix == "" and "" or "/" .. prefix .. "-") .. "| ]]") elseif mw.title.getCurrentTitle().text == langname .. "/" .. prefix .. last .. "-" then -- DO NOT replace with mw.loadData("Module:headword/data").pagename as we need the root portion insert(steps, (make_rhyme_link(lang, prefix .. last .. "-", "-" .. prefix .. last .. "-"))) insert(categories, "[[Category:" .. langname .. " rhymes/" .. prefix .. last .. "-|-]]") else insert(steps, (make_rhyme_link(lang, prefix .. last, "-" .. prefix .. last))) insert(categories, "[[Category:" .. langname .. " rhymes" .. (prefix == "" and "" or "/" .. prefix .. "-") .. "|" .. last .. "]]") end elseif lang:getCode() ~= "und" then insert(categories, "[[Category:" .. langname .. " rhymes| ]]") end if mw.title.getCurrentTitle().nsText == "Rhymes" then frame:callParserFunction("DISPLAYTITLE", mw.title.getCurrentTitle().fullText:gsub( "/(.+)$", function (rhyme) return "/" .. (tag_rhyme(rhyme, lang)) -- ignore cleanup categories end)) end local templateStyles = require(TemplateStyles_module)(rhymes_styles_css_module) local ol = mw.html.create("ol") for _, step in ipairs(steps) do ol:node(mw.html.create("li"):wikitext(step)) end local div = mw.html.create("div") :attr("role", "navigation") :attr("aria-label", "Breadcrumb") :addClass("ts-rhymesBreadcrumbs") :node(ol) local formatted_cats = args.nocat and "" or concat(categories) return templateStyles .. tostring(div) .. formatted_cats end return export rux8hqpvw8gcyeuem8wacj643tk3b4a 176616 176614 2026-04-24T08:24:34Z Yivan000 4078 176616 Scribunto text/plain local export = {} local force_cat = false -- for testing local rhymes_styles_css_module = "Module:rhymes/styles.css" local IPA_module = "Module:IPA" local parameters_module = "Module:parameters" local parameter_utilities_module = "Module:parameter utilities" local pron_qualifier_module = "Module:pron qualifier" local script_utilities_module = "Module:script utilities" local string_utilities_module = "Module:string utilities" local TemplateStyles_module = "Module:TemplateStyles" local utilities_module = "Module:utilities" local concat = table.concat local insert = table.insert local function rsplit(text, pattern) return require(string_utilities_module).split(text, pattern) end local function track(page) require("Module:debug/track")("rhymes/" .. page) return true end local function tag_rhyme(rhyme, lang) local formatted_rhyme, cats, err formatted_rhyme, cats, err = require(IPA_module).format_IPA(lang, rhyme, "raw") return formatted_rhyme, cats, err end local function make_rhyme_link(lang, link_rhyme, display_rhyme) local retval, cats if not link_rhyme then retval = concat{"[[Tugma:", lang:getCanonicalName(), "|", lang:getCanonicalName(), "]]"} --TLCHANGE "[[Rhymes:" cats = {} else local formatted_rhyme formatted_rhyme, cats, err = tag_rhyme(display_rhyme or link_rhyme, lang) retval = concat{"[[Tugma:", lang:getCanonicalName(), "/", link_rhyme, "|", formatted_rhyme, "]]", err} --TLCHANGE "[[Rhymes:" end return retval, cats end --[==[ Implementation of {{tl|rhymes row}}. ]==] function export.show_row(frame) local args = require(parameters_module).process( frame.getParent and frame:getParent().args or frame, { [1] = {required = true, type = "full language"}, [2] = {required = true}, [3] = {}, } ) if not args[1] then return "[[Rhymes:English/aɪmz|<span class=\"IPA\">-aɪmz</span>]]" end -- Discard cleanup categories from make_rhyme_link(). return (make_rhyme_link(args[1], args[2], "-" .. args[2])) .. (args[3] and (" (''" .. args[3] .. "'')") or "") end do local function add_syllable_categories(categories, lang, rhyme, num_syl) local prefix = "Tugma:" .. lang .. "/" .. rhyme --TLCHANGE "Rhymes:" .. lang .. "/" .. rhyme insert(categories, prefix) if num_syl then for _, n in ipairs(num_syl) do local c --TLCHANGE remove all this, make it simple to just add "pantig" --[[ if n > 1 then c = prefix .. "/" .. n .. " syllables" else c = prefix .. "/1 syllable" end ]] c = prefix .. "/" .. n .. " pantig" insert(categories, c) end end end --[==[ Meant to be called from a module. `data` is a table containing the following fields: * `lang`: language object for the rhymes; * `rhymes`: a list of rhymes, each described by an object which specifies the rhyme, optional number of syllables, and optional left and right regular and accent qualifier fields: ** `rhyme`: the rhyme itself; ** `num_syl`: {nil} or a list of numbers, specifying the number of syllables of the word with this rhyme; optional and currently used only for categorization; if omitted, defaults to the top-level `num_syl`; ** `separator`: {nil} or the string used to separate this rhyme from the preceding one when displayed; defaults to the top-level `separator`; ** `q`: {nil} or a list of left regular qualifier strings, formatted using {format_qualifier()} in [[Module:qualifier]] and displayed directly before the rhyme in question; ** `qq`: {nil} or a list of right regular qualifier strings, displayed directly after the rhyme in question; ** `qualifiers`: {nil} or a list of qualifier strings; also displayed on the left; for compatibility purposes only, do not use in new code; ** `a`: {nil} or a list of left accent qualifier strings, formatted using {format_qualifiers()} in [[Module:accent qualifier]] and displayed directly before the rhyme in question; ** `aa`: {nil} or a list of right accent qualifier strings, displayed directly after the rhyme in question; ** `refs`: {nil} or a list of references or reference specs to add directly after the rhyme; the value of a list item is either a string containing the reference text (typically a call to a citation template such as {{tl|cite-book}}, or a template wrapping such a call), or an object with fields `text` (the reference text), `name` (the name of the reference, as in {{cd|<nowiki><ref name="foo">...</ref></nowiki>}} or {{cd|<nowiki><ref name="foo" /></nowiki>}}) and/or `group` (the group of the reference, as in {{cd|<nowiki><ref name="foo" group="bar">...</ref></nowiki>}} or {{cd|<nowiki><ref name="foo" group="bar"/></nowiki>}}); this uses a parser function to format the reference appropriately and insert a footnote number that hyperlinks to the actual reference, located in the {{cd|<nowiki><references /></nowiki>}} section; ** `nocat`: if {true}, suppress categorization for this rhyme only; * `num_syl`: {nil} or a list of numbers, specifying the number of syllables for all rhymes; optional and currently used only for categorization; overridable at the individual rhyme level; * `separator`: {nil} or a string, specifying the separator displayed before all rhymes but the first; by default, {", "}; overridable at the individual rhyme level; * `q`: {nil} or a list of left regular qualifier strings, formatted using {format_qualifier()} in [[Module:qualifier]] and displayed before the initial caption; * `qq`: {nil} or a list of right regular qualifier strings, displayed after all rhymes; * `qualifiers`: {nil} or a list of left regular qualifier strings; for compatibility purposes only, do not use in new code; * `a`: {nil} or a list of left accent qualifier strings, formatted using {format_qualifiers()} in [[Module:accent qualifier]] and dispalyed before the initial caption; * `aa`: {nil} or a list of right accent qualifier strings, displayed after all rhymes; * `sort`: {nil} or sort key; * `caption`: {nil} or string specifying the caption to use, in place of {"Rhymes"}; a colon and space is automatically added after the caption; * `nocaption`: if {true}, suppress the caption display; * `nocat`: if {true}, suppress categorization; * `force_cat`: if {true}, force categorization even on non-mainspace pages. If both regular and accent qualifiers on the same side and at the same level are specified, the accent qualifiers precede the regular qualifiers on both left and right. '''WARNING''': Destructively modifies the objects inside the `rhymes` field. Note that the number of syllables is currently used only for categorization; if present, an extra category will be added such as [[:Category:Rhymes:Italian/ino/3 syllables]] in addition to [[:Category:Rhymes:Italian/ino]]. ]==] function export.format_rhymes(data) local langname = data.lang:getFullName() local parts = {} local categories = {} local overall_sep = data.separator or ", " for i, r in ipairs(data.rhymes) do local rhyme = r.rhyme local link, link_cats = make_rhyme_link(data.lang, rhyme, "-" .. rhyme) if not r.nocat and not data.nocat then for _, cat in ipairs(link_cats) do insert(categories, cat) end end if r.qualifiers then track("old-qualifiers") end if r.q and r.q[1] or r.qq and r.qq[1] or r.qualifiers and r.qualifiers[1] or r.a and r.a[1] or r.aa and r.aa[1] or r.refs and r.refs[1] then link = require(pron_qualifier_module).format_qualifiers { lang = data.lang, text = link, q = r.q, qq = r.qq, qualifiers = r.qualifiers, a = r.a, aa = r.aa, refs = r.refs, } end insert(parts, r.separator or i > 1 and overall_sep or "") insert(parts, link) if not r.nocat and not data.nocat then add_syllable_categories(categories, langname, rhyme, r.num_syl or data.num_syl) end end local text = concat(parts) if not data.nocaption then text = (data.caption or "Tugma") .. ": " .. text --TLCHANGE "Rhymes" end if data.q and data.q[1] or data.qq and data.qq[1] or data.a and data.a[1] or data.aa and data.aa[1] then text = require(pron_qualifier_module).format_qualifiers { lang = data.lang, text = text, q = data.q, qq = data.qq, a = data.a, aa = data.aa, } end if categories[1] then local categories = require(utilities_module).format_categories(categories, data.lang, data.sort, nil, force_cat or data.force_cat) text = text .. categories end return text end end --[==[ Implementation of {{tl|rhymes}}. ]==] function export.show(frame) local parent_args = frame:getParent().args local compat = parent_args.lang local offset = compat and 0 or 1 local lang_param = compat and "lang" or 1 local plain = {} local boolean = {type = "boolean"} local params = { [lang_param] = {required = true, type = "language", default = "en"}, [1 + offset] = {list = true, required = true, disallow_holes = true, default = "aɪmz"}, ["caption"] = plain, ["nocaption"] = boolean, ["nocat"] = boolean, ["sort"] = plain, } local m_param_utils = require(parameter_utilities_module) local param_mods = m_param_utils.construct_param_mods { { param = "s", item_dest = "num_syl", separate_no_index = true, type = "number", sublist = true, }, {group = {"q", "a", "ref"}}, } local rhymes, args = m_param_utils.parse_list_with_inline_modifiers_and_separate_params { params = params, param_mods = param_mods, raw_args = parent_args, termarg = 1 + offset, term_dest = "rhyme", track_module = "rhymes", } local lang = args[lang_param] local data = { lang = lang, rhymes = rhymes, num_syl = args.s.default, caption = args.caption, nocaption = args.nocaption, nocat = args.nocat, sort = args.sort, q = args.q.default, qq = args.qq.default, a = args.a.default, aa = args.aa.default, } return export.format_rhymes(data) end --[==[ Implementation of {{tl|rhymes nav}}. ]==] function export.show_nav(frame) local args = require(parameters_module).process( frame:getParent().args, { [1] = {required = true, type = "full language", default = "und"}, [2] = {list = true, allow_holes = true}, ["nocat"] = {type = "boolean"}, } ) local lang = args[1] local langname = lang:getCanonicalName() local parts = args[2] -- Create steps -- FIXME: We should probably use format_categories() in [[Module:utilities]] rather than constructing categories -- manually. local categories = {} -- Here and below, we ignore any cleanup categories coming out of make_rhyme_link() by adding an extra set of parens -- around the call to make_rhyme_link() to cause the second argument (the categories) to be ignored. {{rhymes nav}} -- is run on a rhymes page so it's not clear we want the page to be added to any such categories, if they exist. local steps = {"[[Wiktionary:Rhymes|Rhymes]]", (make_rhyme_link(lang))} if #parts > 0 then local last = parts[#parts] parts[#parts] = nil local prefix = "" for i, part in ipairs(parts) do prefix = prefix .. part parts[i] = prefix end for _, part in ipairs(parts) do insert(steps, (make_rhyme_link(lang, part .. "-", "-" .. part .. "-"))) end if last == "-" then insert(steps, (make_rhyme_link(lang, prefix, "-" .. prefix))) insert(categories, "[[Category:" .. langname .. " rhymes" .. (prefix == "" and "" or "/" .. prefix .. "-") .. "| ]]") elseif mw.title.getCurrentTitle().text == langname .. "/" .. prefix .. last .. "-" then -- DO NOT replace with mw.loadData("Module:headword/data").pagename as we need the root portion insert(steps, (make_rhyme_link(lang, prefix .. last .. "-", "-" .. prefix .. last .. "-"))) insert(categories, "[[Category:" .. langname .. " rhymes/" .. prefix .. last .. "-|-]]") else insert(steps, (make_rhyme_link(lang, prefix .. last, "-" .. prefix .. last))) insert(categories, "[[Category:" .. langname .. " rhymes" .. (prefix == "" and "" or "/" .. prefix .. "-") .. "|" .. last .. "]]") end elseif lang:getCode() ~= "und" then insert(categories, "[[Category:" .. langname .. " rhymes| ]]") end if mw.title.getCurrentTitle().nsText == "Rhymes" then frame:callParserFunction("DISPLAYTITLE", mw.title.getCurrentTitle().fullText:gsub( "/(.+)$", function (rhyme) return "/" .. (tag_rhyme(rhyme, lang)) -- ignore cleanup categories end)) end local templateStyles = require(TemplateStyles_module)(rhymes_styles_css_module) local ol = mw.html.create("ol") for _, step in ipairs(steps) do ol:node(mw.html.create("li"):wikitext(step)) end local div = mw.html.create("div") :attr("role", "navigation") :attr("aria-label", "Breadcrumb") :addClass("ts-rhymesBreadcrumbs") :node(ol) local formatted_cats = args.nocat and "" or concat(categories) return templateStyles .. tostring(div) .. formatted_cats end return export i8cxdlcta8x9d135cznqrkfmm9w8mlj Module:category tree/poscatboiler 828 34545 176620 171948 2026-04-24T08:54:30Z Yivan000 4078 176620 Scribunto text/plain local lang_independent_data = require("Module:category tree/data") local lang_specific_module = "Module:category tree/lang" local lang_specific_module_prefix = lang_specific_module .. "/" local family_specific_module = "Module:category tree/fam" local family_specific_module_prefix = family_specific_module .. "/" local labels_utilities_module = "Module:labels/utilities" local template_parser_module = "Module:template parser" local concat = table.concat local dump = mw.dumpObject local expand_template = require("Module:frame").expandTemplate local insert = table.insert local is_callable = require("Module:fun").is_callable local lcfirst = require("Module:string utilities").lcfirst local list_to_set = require("Module:table").listToSet local make_title = mw.title.makeTitle local new_title = mw.title.new local parse = require(template_parser_module).parse local sparse_concat = require("Module:table").sparseConcat local tostring = tostring local type = type local ucfirst = require("Module:string utilities").ucfirst local uupper = require("Module:string utilities").upper local function internal_error(msg) error("Internal error: " .. msg) end local function get_lang(...) local _get_lang = require("Module:languages").getByCode function get_lang(...) return _get_lang(...) or require("Module:languages/errorGetBy").code(...) end return get_lang(...) end local function get_script(...) local _get_script = require("Module:scripts").getByCode function get_script(code) return _get_script(code) or require("Module:languages/error")(code, true, "script code") end return get_script(...) end -- Category object local Category = {} Category.__index = Category function Category:get_originating_info() local originating_info = "" if self._info.originating_label then originating_info = " (originating from label \"" .. self._info.originating_label .. "\" in module [[" .. self._info.originating_module .. "]])" end return originating_info end local valid_keys = list_to_set{"code", "label", "sc", "raw", "args", "also", "called_from_inside", "originating_label", "originating_module"} function Category.new(info) for key in pairs(info) do if not valid_keys[key] then internal_error("The parameter \"" .. key .. "\" was not recognized.") end end local self = setmetatable({}, Category) self._info = info if not self._info.label then internal_error("No label was specified.") end self:initCommon() if not self._data then internal_error("The " .. (self._info.raw and "raw " or "") .. "label \"" .. self._info.label .. "\" does not exist" .. self:get_originating_info() .. ".") end return self end function Category:initCommon() local function patch_args(args) -- This fixes the issue with Scribunto automatically converting keys -- in a table as numbers to strings, which in turn causes a circular -- error for having argument parameter names as numbers as strings. if type(args) ~= "table" then return args end local new_args = {} for k, v in pairs(args) do if type(k) == "string" and string.len(k) < 10 and not string.match(k, "^0") and string.match(k, "^%d+$") then new_args[tonumber(k)] = patch_args(v) else new_args[k] = patch_args(v) end end return new_args end local args_handled = false if self._info.raw then -- Check if the category exists local raw_categories = lang_independent_data["RAW_CATEGORIES"] self._data = raw_categories[self._info.label] if self._data then if self._data.lang then self._lang = get_lang(self._data.lang) self._info.code = self._lang:getCode() end if self._data.sc then self._sc = get_script(self._data.sc) self._info.sc = self._sc:getCode() end else -- Go through raw handlers local data = { category = self._info.label, args = patch_args(self._info.args) or {}, called_from_inside = self._info.called_from_inside, } for _, handler in ipairs(lang_independent_data["RAW_HANDLERS"]) do self._data, args_handled = handler.handler(data) if self._data then self._data.module = self._data.module or handler.module break end end if self._data then -- Update the label if the handler specified a canonical name for it. if self._data.canonical_name then self._info.canonical_name = self._data.canonical_name end if self._data.lang then if type(self._data.lang) ~= "string" then internal_error("Received non-string value " .. dump(self._data.lang) .. " for self._data.lang, label \"" .. self._info.label .. "\"" .. self:get_originating_info() .. ".") end self._lang = get_lang(self._data.lang) self._info.code = self._lang:getCode() end if self._data.sc then if type(self._data.sc) ~= "string" then internal_error("Received non-string value " .. dump(self._data.sc) .. " for self._data.sc, label \"" .. self._info.label .. "\"" .. self:get_originating_info() .. ".") end self._sc = get_script(self._data.sc) self._info.sc = self._sc:getCode() end end end else -- Already parsed into language + label if self._info.code then self._lang = get_lang(self._info.code) else self._lang = nil end if self._info.sc then self._sc = get_script(self._info.sc) else self._sc = nil end self._info.orig_label = self._info.label if not self._lang then -- Umbrella categories without a preceding language always begin with a capital letter, but the actual label may be -- lowercase (cf. [[:Category:Nouns by language]] with label 'nouns' with per-language [[:Category:English nouns]]; -- but [[:Category:Reddit slang by language]] with label 'Reddit slang' with per-language -- [[:Category:English Reddit slang]]). Since the label is almost always lowercase, we lowercase it for umbrella -- categories, storing the original into `orig_label`, and correct it later if needed. self._info.label = lcfirst(self._info.label) end -- First, check lang-specific labels and handlers if this is not an umbrella category. if self._lang then local objects_with_modules = require(lang_specific_module) local obj, seen = self._lang, {} local object_specific_module_prefix = lang_specific_module_prefix local is_family = false repeat if objects_with_modules[obj:getCode()] then local module = object_specific_module_prefix .. obj:getCode() local labels_and_handlers = require(module) if labels_and_handlers.LABELS then self._data = labels_and_handlers.LABELS[self._info.label] if self._data then if not is_family and self._data.umbrella == nil and self._data.umbrella_parents == nil then self._data.umbrella = false end self._data.module = self._data.module or module end end if not self._data and labels_and_handlers.HANDLERS then for _, handler in ipairs(labels_and_handlers.HANDLERS) do local data = { label = self._info.label, lang = self._lang, sc = self._sc, args = patch_args(self._info.args) or {}, called_from_inside = self._info.called_from_inside, } self._data, args_handled = handler(data) if self._data then if not is_family and self._data.umbrella == nil and self._data.umbrella_parents == nil then self._data.umbrella = false end self._data.module = self._data.module or module break end end end if self._data then break end end seen[obj:getCode()] = true obj = obj:getFamily() if not is_family then is_family = true object_specific_module_prefix = family_specific_module_prefix objects_with_modules = require(family_specific_module) end until not obj or seen[obj:getCode()] end local function fetch_label_data(labels) self._data = labels[self._info.label] -- See comment above about uppercase- vs. lowercase-initial labels, which are indistinguishable -- in umbrella categories. if not self._data then self._data = labels[self._info.orig_label] if self._data then self._info.label = self._info.orig_label end end end -- Then check lang-independent labels. if not self._data then -- lang_independent_data.LABELS should always exist. fetch_label_data(lang_independent_data.LABELS) if not self._data and not self._lang then -- Check family-specific labels for umbrella label. local families_with_modules = require(family_specific_module) for famcode, _ in pairs(families_with_modules) do local module = family_specific_module_prefix .. famcode local labels_and_handlers = require(module) if labels_and_handlers.LABELS then fetch_label_data(labels_and_handlers.LABELS) if self._data then self._data.module = self._data.module or module break end end end end end -- Then check lang-independent handlers. if not self._data then local data = { label = self._info.label, lang = self._lang, sc = self._sc, args = patch_args(self._info.args) or {}, called_from_inside = self._info.called_from_inside, } for _, handler in ipairs(lang_independent_data["HANDLERS"]) do self._data, args_handled = handler.handler(data) if self._data then self._data.module = self._data.module or handler.module break end end if not self._data and not self._lang then -- Check family-specific labels for umbrella handler. local families_with_modules = require(family_specific_module) for famcode, _ in pairs(families_with_modules) do local module = family_specific_module_prefix .. famcode local labels_and_handlers = require(module) if labels_and_handlers.HANDLERS then for _, handler in ipairs(labels_and_handlers.HANDLERS) do local data = { label = self._info.label, sc = self._sc, args = patch_args(self._info.args) or {}, called_from_inside = self._info.called_from_inside, } self._data, args_handled = handler(data) if self._data then self._data.module = self._data.module or module break end end end if self._data then break end end end end end if not args_handled and self._data and self._info.args and next(self._info.args) then local module_text = " (handled in [[" .. (self._data.module or "UNKNOWN").. "]])" local args_text = {} for k, v in pairs(self._info.args) do insert(args_text, k .. "=" .. ((type(v) == "string" or type(v) == "number") and v or dump(v))) end error("poscatboiler label '" .. self._info.label .. "' " .. module_text .. " doesn't accept extra args " .. concat(args_text, ", ")) end if self._sc and not self._lang then internal_error("Umbrella categories cannot have a script specified.") end end function Category:convert_spec_to_string(desc) if not desc then return desc end local desc_type = type(desc) if desc_type == "string" then return desc elseif desc_type == "number" then return tostring(desc) elseif not is_callable(desc) then internal_error("`desc` must be a string, number, function, callable table or nil; received " .. dump(desc)) end desc = desc { lang = self._lang, sc = self._sc, label = self._info.label, raw = self._info.raw, } if not desc then return desc end desc_type = type(desc) if desc_type == "string" then return desc end internal_error("The value returned by `desc` must be a string or nil; received " .. dump(desc)) end local function add_obj_args(args, obj, obj_type) if obj then args[obj_type .. "code"] = obj:getCode() args[obj_type .. "name"] = obj:getCanonicalName() args[obj_type .. "disp"] = obj:getDisplayForm() args[obj_type .. "cat"] = obj:getCategoryName() args[obj_type .. "link"] = obj:makeCategoryLink() end end -- Expands `desc` like a template, passing values for specs like {{{langname}}}. function Category:substitute_template_specs(desc) -- This may end up happening twice but that's OK as the function is (usually) idempotent. -- FIXME: Not idempotent if a preprocessed template returns wikicode. desc = self:convert_spec_to_string(desc) if not desc then return nil end -- Populate the substitution arguments. local args = {} args.umbrella_msg = "Isa itong ''kataasang'' kategorya. Wala itong entrada ng diksiyonaryo, kundi iba pang kategoryang pangwika na naglalaman ng mga termino sa wikang iyon." --TLCHANGE args.umbrella_meta_msg = "Isa itong ''kataas-taasang'' kategorya, na sinasaklaw ang mga paksang \"lema\", \"pangalan\" o \"salita ayon sa etimolohiya\". Wala itong entrada ng diksiyonaryo, kundi mga kataasang kategorya na sumasaklaw ng mga tiyak na paksa, na naglalaman ng mga kategoryang pangwika para sa parehong paksa." --TLCHANGE add_obj_args(args, self._lang, "lang") add_obj_args(args, self._sc, "sc") return parse(desc, true):expand(args) end function Category:substitute_template_specs_in_args(args) if not args then return args end local pinfo = {} for k, v in pairs(args) do pinfo[self:substitute_template_specs(k)] = self:substitute_template_specs(v) end return pinfo end function Category:make_new(info) info.originating_label = self._info.label info.originating_module = self._data.module info.called_from_inside = true return Category.new(info) end function Category:getBreadcrumbName() local ret if self._lang or self._info.raw then ret = self._data.breadcrumb or self._data.breadcrumb_and_first_sort_base else ret = self._data.umbrella and (self._data.umbrella.breadcrumb or self._data.umbrella.breadcrumb_and_first_sort_base) end if not ret then ret = self._info.label end if type(ret) ~= "table" then ret = {name = ret} end local name = self:substitute_template_specs(ret.name) local nocap = ret.nocap if self._sc then name = name .. " in " .. self._sc:getDisplayForm() end --TLCHANGE to take into account the "na" word, remove it if (name:match("^[Nn]a ")) then name = ucfirst(name:gsub("^[Nn]a ", "")) end return name, nocap end local function expand_toc_template_if(template) local template_obj = new_title(template, 10) if template_obj.exists then return expand_template{title = template_obj.text} end return nil end -- Return the textual expansion of the first existing template among the given templates, first performing -- substitutions on the template name such as replacing {{{langcode}}} with the current language's code (if any). -- If no templates exist after expansion, or if nil is passed in, return nil. If a single string is passed in, -- treat it like a one-element list consisting of that string. function Category:get_template_text(templates) if templates == nil then return nil elseif type(templates) ~= "table" then templates = {templates} end for _, template in ipairs(templates) do if template == false then return false end template = self:substitute_template_specs(template) return expand_toc_template_if(template) end return nil end function Category:getTOC(toc_type) -- Type "none" means everything fits on a single page; in that case, display nothing. if toc_type == "none" then return nil end local templates, fallback_templates -- If TOC type is "full" (more than 2500 entries), do the following, in order: -- 1. look up and expand the `toc_template_full` templates (normal or umbrella, depending on whether there is -- a current language); -- 2. look up and expand the `toc_template` templates (normal or umbrella, as above); -- 3. do the default behavior, which is as follows: -- 3a. look up a language-specific "full" template according to the current language (using English if there -- is no current language); -- 3b. look up a script-specific "full" template according to the first script of current language (using English -- if there is no current language); -- 3c. look up a language-specific "normal" template according to the current language (using English if there -- is no current language); -- 3d. look up a script-specific "normal" template according to the first script of the current language (using -- English if there is no current language); -- 3e. display nothing. -- -- If TOC type is "normal" (between 200 and 2500 entries), do the following, in order: -- 1. look up and expand the `toc_template` templates (normal or umbrella, depending on whether there is -- a current language); -- 2. do the default behavior, which is as follows: -- 2a. look up a language-specific "normal" template according to the current language (using English if there -- is no current language); -- 2b. look up a script-specific "normal" template according to the first script of the current language (using -- English if there is no current language); -- 2c. display nothing. local data_source if self._lang or self._info.raw then data_source = self._data else data_source = self._data.umbrella end if data_source then if toc_type == "full" then templates = data_source.toc_template_full fallback_templates = data_source.toc_template else templates = data_source.toc_template end end local text = self:get_template_text(templates) if text then return text elseif text == false then return nil end text = self:get_template_text(fallback_templates) if text then return text elseif text == false then return nil end local default_toc_templates_to_check = {} local lang, sc = self:getCatfixInfo() local langcode = lang and lang:getCode() or "tl" --TLCHANGE local sccode = sc and sc:getCode() or lang and lang:getScriptCodes()[1] or "Latn" -- FIXME: What is toctemplateprefix used for? local tocname = (self._data.toctemplateprefix or "") .. "categoryTOC" if toc_type == "full" then insert(default_toc_templates_to_check, ("%s-%s/full"):format(langcode, tocname)) insert(default_toc_templates_to_check, ("%s-%s/full"):format(sccode, tocname)) end insert(default_toc_templates_to_check, ("%s-%s"):format(langcode, tocname)) insert(default_toc_templates_to_check, ("%s-%s"):format(sccode, tocname)) for _, toc_template in ipairs(default_toc_templates_to_check) do local toc_template_text = expand_toc_template_if(toc_template) if toc_template_text then return toc_template_text end end return nil end function Category:getInfo() return self._info end function Category:getDataModule() return self._data.module end function Category:canBeEmpty() if self._lang or self._info.raw then return self._data.can_be_empty end return self._data.umbrella and self._data.umbrella.can_be_empty end function Category:isHidden() if self._lang or self._info.raw then return self._data.hidden end return self._data.umbrella and self._data.umbrella.hidden end function Category:getCategoryName() if self._info.raw then return self._info.canonical_name or self._info.label elseif self._lang then local ret = self._lang:getCanonicalName() .. " " .. self._info.label if self._sc then ret = ret .. " in " .. self._sc:getDisplayForm() end return ucfirst(ret) end local ret = ucfirst(self._info.label) if not (self._data.no_by_language or self._data.umbrella and self._data.umbrella.no_by_language) then --TLCHANGE to take into account the "na" word if (ret:match("^[Nn]a ")) then ret = ucfirst(ret:gsub("^[Nn]a ", "")) .. " ayon sa wika" else ret = ret .. " ayon sa wika" --TLCHANGE end end return ret end function Category:getTopright() if self._lang or self._info.raw then return self:substitute_template_specs(self._data.topright) end return self._data.umbrella and self:substitute_template_specs(self._data.umbrella.topright) end function Category:display_title(displaytitle, lang) if type(displaytitle) == "string" then displaytitle = self:substitute_template_specs(displaytitle) else displaytitle = displaytitle(self:getCategoryName(), lang) end mw.getCurrentFrame():callParserFunction("DISPLAYTITLE", "Kategorya:" .. displaytitle) --TLCHANGE "Category:" end function Category:get_labels_categorizing() local m_labels_utilities = require(labels_utilities_module) local pos_cat_labels, sense_cat_labels, use_tlb pos_cat_labels = m_labels_utilities.find_labels_for_category(self._info.label, "pos", self._lang) local sense_label = self._info.label:match("^(.*) terms$") if sense_label then use_tlb = true else sense_label = self._info.label:match("^terms with (.*) senses$") end if not sense_label then return nil end sense_cat_labels = m_labels_utilities.find_labels_for_category(sense_label, "sense", self._lang) if use_tlb then return m_labels_utilities.format_labels_categorizing(pos_cat_labels, sense_cat_labels, self._lang) end local all_labels = pos_cat_labels for k, v in pairs(sense_cat_labels) do all_labels[k] = v end return m_labels_utilities.format_labels_categorizing(all_labels, nil, self._lang) end -- FIXME: this is clunky. local function remove_lang_params(desc) -- Simply remove a language name/code/category from the beginning of the string, but replace the language name -- in the middle of the string with either "specific languages" or "specific-language" depending on whether the -- language name appears to be an attributive qualifier of another noun or to stand by itself. This may be wrong, -- in which case the category in question should supply its own umbrella description. desc = desc:gsub("^{{{langname}}} ", "") :gsub("{{{langname}}} %(", "specific languages (") :gsub("{{{langname}}}([.,])", "specific languages%1") :gsub("{{{langname}}} ", "specific-language ") :gsub("{{{langdisp}}}", "specific languages") :gsub("{{{langlink}}}", "specific languages") return desc end --TLCHANGE ADD THIS FUNCTION TO GET THE ENGLISH NAME function Category:getEnglishName() -- if there is no "english_name" added in the data, then output nil if not self._data.english_name then return nil end --override for specific kinds to remove adding the langname at the start if self._data.english_name:find("Varieties") or self._data.english_name:find("Regional") or self._data.english_name:find("Rhymes") then return self._data.english_name end --if it is a language category if self._lang then --if it is a topic category or a regular language category local code, ___upcase_label = self._info.label:match("^(%l[%a-]*%a):(.+)$") if code then return code .. ":" .. self._data.english_name else -- default to canonical name if no english_name local english_lang_name = self._lang:getData().english_name or self._lang:getCanonicalName() return english_lang_name .. " " .. self._data.english_name end elseif not (self._data.no_by_language or self._data.umbrella and self._data.umbrella.no_by_language) then --if it is an language umbrella category if self._info.label:match("^[Nn]a ") then return ucfirst(self._data.english_name) .. " by language" end return self._data.english_name else return self._data.english_name end end ----- function Category:getDescription(isChild) -- Allows different text in the list of a category's children local isChild = isChild == "child" if self._lang or self._info.raw then if not isChild and self._data.displaytitle then self:display_title(self._data.displaytitle, self._lang) end if self._sc then return self:getCategoryName() .. "." end local desc = self:substitute_template_specs(self._data.description) if not desc then return nil elseif isChild then return desc end return sparse_concat({ self:substitute_template_specs(self._data.preceding), desc, self:substitute_template_specs(self._data.additional), self:substitute_template_specs(self:get_labels_categorizing()), }, "\n\n") end local umbrella = self._data.umbrella if not isChild and umbrella and umbrella.displaytitle then self:display_title(umbrella.displaytitle) end local desc = self:substitute_template_specs(umbrella and umbrella.description) local has_umbrella_desc = not not desc if not desc then desc = self:convert_spec_to_string(self._data.description) if desc then desc = remove_lang_params(desc) desc = lcfirst(desc) desc = desc:gsub("%.$", "") desc = "Categories with " .. desc .. "." else desc = "Categories with " .. self._info.label .. " in various specific languages." end desc = self:substitute_template_specs(desc) end if isChild then return desc end return sparse_concat({ self:substitute_template_specs(umbrella and umbrella.preceding or not has_umbrella_desc and self._data.preceding), desc, self:substitute_template_specs(umbrella and umbrella.additional or not has_umbrella_desc and self._data.additional), self:substitute_template_specs("{{{umbrella_msg}}}"), self:substitute_template_specs(self:get_labels_categorizing()), }, "\n\n") end function Category:new_sortkey(sortkey) local sortkey_type = type(sortkey) if sortkey_type == "string" then sortkey = uupper(sortkey) elseif sortkey_type == "table" then function sortkey:makeSortKey() local sort_func = self.sort_func if sort_func ~= nil then return sort_func(self.sort_base) end local lang = self.lang if lang == nil then return self.sort_base end lang = get_lang(lang, nil, true) if lang == nil then return self.sort_base end local sc = self.sc if sc ~= nil then sc = get_script(sc) end return lang:makeSortKey(self.sort_base, sc) end end return sortkey end function Category:inherit_spec(spec, parent_spec, substitute_result) if spec == false then return nil end local retval = spec or parent_spec if substitute_result then retval = self:substitute_template_specs(retval) end return retval end function Category:canonicalize_parents_children(cats, is_children, fallback_sort_base) if not cats then return nil elseif type(cats) == "table" then if cats.name or cats.module then cats = {cats} elseif #cats == 0 then return nil end else cats = {cats} end local ret = {} for _, cat in ipairs(cats) do if type(cat) ~= "table" or not cat.name and not cat.module then cat = {name = cat} end insert(ret, cat) end local is_umbrella = not self._lang and not self._info.raw local table_type = is_children and "extra_children" or "parents" for i, cat in ipairs(ret) do local raw if self._info.raw or is_umbrella then raw = not cat.is_label else raw = cat.raw end local lang = self:inherit_spec(cat.lang, not raw and self._info.code or nil, "substitute") local sc = self:inherit_spec(cat.sc, not raw and self._info.sc or nil, "substitute") -- Get the sortkey. local sortkey = self:inherit_spec(cat.sort, i == 1 and fallback_sort_base and {sort_base = fallback_sort_base} or nil) if type(sortkey) == "table" then sortkey.sort_base = self:substitute_template_specs(sortkey.sort_base) or internal_error("Missing .sort_base in '" .. table_type .. "' .sort table for '" .. self._info.label .. "' category entry in module '" .. (self._data.module or "unknown") .. "'") if sortkey.sort_func then -- Not allowed to give a lang and/or script if sort_func is given. local bad_spec = sortkey.lang and "lang" or sortkey.sc and "sc" or nil if bad_spec then internal_error("Cannot specify both ." .. bad_spec .. " and .sort_func in '" .. table_type .. "' .sort table for '" .. self._info.label .. "' category entry in module '" .. (self._data.module or "unknown") .. "'") end else sortkey.lang = self:inherit_spec(sortkey.lang, lang, "substitute") sortkey.sc = self:inherit_spec(sortkey.sc, sc, "substitute") end else sortkey = self:substitute_template_specs(sortkey) end local name if cat.module then -- A reference to a category using another category tree module. if not cat.args then internal_error("Missing .args in '" .. table_type .. "' table with module=\"" .. cat.module .. "\" for '" .. self._info.label .. "' category entry in module '" .. (self._data.module or "unknown") .. "'") end name = require("Module:category tree/" .. cat.module).new(self:substitute_template_specs_in_args(cat.args)) else name = cat.name if not name then internal_error("Missing .name in " .. (is_umbrella and "umbrella " or "") .. "'" .. table_type .. "' table for '" .. self._info.label .. "' category entry in module '" .. (self._data.module or "unknown") .. "'") elseif type(name) == "string" then -- otherwise, assume it's a category object and use it directly name = self:substitute_template_specs(name) if name:find("^Category:") then -- It's a non-poscatboiler category name. sortkey = sortkey or is_children and name:gsub("^Category:", "") or self:getCategoryName() else -- It's a label. sortkey = sortkey or is_children and name or self._info.label name = self:make_new{ label = name, code = lang, sc = sc, raw = raw, args = self:substitute_template_specs_in_args(cat.args) } end end end sortkey = sortkey or is_children and " " or self._info.label ret[i] = { name = name, description = is_children and self:substitute_template_specs(cat.description) or nil, sort = self:new_sortkey(sortkey) } end return ret end function Category:getParents() local is_umbrella, ret = not self._lang and not self._info.raw if self._sc then local parent1 = self:make_new{code = self._info.code, label = "terms in " .. self._sc:getCanonicalName() .. " script"} local parent2 = self:make_new{code = self._info.code, label = self._info.label, raw = self._info.raw, args = self._info.args} ret = { {name = parent1, sort = self._sc:getCanonicalName()}, {name = parent2, sort = self._sc:getCanonicalName()}, } else local parents, fallback_sort_base if is_umbrella then parents = self._data.umbrella and self._data.umbrella.parents or self._data.umbrella_parents fallback_sort_base = self._data.umbrella and self._data.umbrella.breadcrumb_and_first_sort_base or nil else parents = self._data.parents fallback_sort_base = self._data.breadcrumb_and_first_sort_base end ret = self:canonicalize_parents_children(parents, nil, fallback_sort_base) if not ret then return nil end end local self_cat = self:getCategoryName() for _, parent in ipairs(ret) do local parent_cat = parent.name.getCategoryName and parent.name:getCategoryName() if self_cat == parent_cat then internal_error(("Infinite loop would occur, as parent category '%s' is the same as the child category"):format(self_cat)) end end return ret end function Category:getChildren() local is_umbrella = not self._lang and not self._info.raw local children = self._data.children local ret = {} if not is_umbrella and children then for _, child in ipairs(children) do child = mw.clone(child) if type(child) ~= "table" then child = {name = child} end if not child.sort then child.sort = child.name end -- FIXME, is preserving the script correct? child.name = self:make_new{code = self._info.code, label = child.name, raw = child.raw, sc = self._info.sc} insert(ret, child) end end local extra_children if is_umbrella then extra_children = self._data.umbrella and self._data.umbrella.extra_children else extra_children = self._data.extra_children end extra_children = self:canonicalize_parents_children(extra_children, "children") if extra_children then for _, child in ipairs(extra_children) do insert(ret, child) end end return #ret > 0 and ret or nil end function Category:getUmbrella() local umbrella = self._data.umbrella if umbrella == false or self._info.raw or not self._lang or self._sc then return nil end -- If `umbrella` is a string, use that; otherwise, use the label. return self:make_new({label = type(umbrella) == "string" and umbrella or self._info.label}) end function Category:getAppendix() return nil end --[=[ TLCHANGE THERE IS NO APPENDIX NAMESPACE (id 100) YET. UNCOMMENT IF THERE IS ALREADY. -- FIXME, this should be customizable. local lang, label = self._lang, self._info.label if self._info.raw or not (lang and label) then return nil end local appendix = make_title(100, lang:getCanonicalName() .. " " .. label) --return appendix.exists and appendix.fullText or nil end ]=] function Category:getCatfixInfo() if self._lang or self._sc or self._info.raw then local langcode, sccode, lang, sc = self._data.catfix, self._data.catfix_sc if langcode then langcode = self:substitute_template_specs(langcode) lang = get_lang(langcode) elseif langcode == nil then -- not false lang = self._lang end if sccode then sccode = self:substitute_template_specs(sccode) sc = get_script(sccode) elseif sccode == nil then -- not false sc = self._sc end return lang, sc elseif not self._data.umbrella then return end -- umbrella local langcode, sccode, lang, sc = self._data.umbrella.catfix, self._data.umbrella.catfix_sc if langcode then langcode = self:substitute_template_specs(langcode) lang = get_lang(langcode) end if sccode then sccode = self:substitute_template_specs(sccode) sc = get_script(sccode) end return lang, sc end function Category:getTOCTemplateName() -- This should only be invoked if getTOC() returns true, meaning to do the default algorithm, but getTOC() -- implements its own default algorithm. internal_error("This should never get called") end local export = {} function export.main(info) local self = setmetatable({_info = info}, Category) self:initCommon() return self._data and self or nil end export.new = Category.new return export b5rwv2idm2ucktrnq5hn2d564vay4gf Module:category tree/languages 828 34557 176624 176000 2026-04-24T09:01:06Z Yivan000 4078 176624 Scribunto text/plain local new_title = mw.title.new local ucfirst = require("Module:string utilities").ucfirst local split = require("Module:string utilities").split local raw_categories = {} local raw_handlers = {} local m_languages = require("Module:languages") local m_sc_getByCode = require("Module:scripts").getByCode local m_table = require("Module:table") local parse_utilities_module = "Module:parse utilities" local concat = table.concat local insert = table.insert local reverse_ipairs = m_table.reverseIpairs local serial_comma_join = m_table.serialCommaJoin local size = m_table.size local sorted_pairs = m_table.sortedPairs local to_json = require("Module:JSON").toJSON local Hang = m_sc_getByCode("Hang") local Hani = m_sc_getByCode("Hani") local Hira = m_sc_getByCode("Hira") local Hrkt = m_sc_getByCode("Hrkt") local Kana = m_sc_getByCode("Kana") local function track(page) -- [[Special:WhatLinksHere/Wiktionary:Tracking/category tree/languages/PAGE]] return require("Module:debug/track")("category tree/languages/" .. page) end -- This handles language categories of the form e.g. [[:Category:French language]] and -- [[:Category:British Sign Language]]; categories like [[:Category:Languages of Indonesia]]; categories like -- [[:Category:English-based creole or pidgin languages]]; and categories like -- [[:Category:English-based constructed languages]]. ----------------------------------------------------------------------------- -- -- -- RAW CATEGORIES -- -- -- ----------------------------------------------------------------------------- raw_categories["Lahat ng wika"] = { --TLCHANGE "All languages" topright = "{{commonscat|Languages}}\n[[File:Languages world map-transparent background.svg|thumb|right|250px|Rough world map of language families]]", --TLCHANGE description = "Nilalaman ng kategoryang ito ang mga kategorya ng lahat ng wika sa Wiksiyonaryo.", additional = "Hindi lahat ng mga maaaring wika sa Wiksiyonaryo ay nandito. Maraming mga iba na hindi " .. "pa nabibigyan ng atensyon sa mga editor, marahil dahil hindi lahat ng gumagamit ng Wiksiyonaryo ay marunong sa lahat ng wika." .. "Tignan ang [[Wiksiyonaryo:Listahan ng mga wika]] para sa kumpletong listahan.", parents = { "Pangkalahatan", --TLCHANGE "Fundamental", }, english_name = "All languages" --TLCHANGE } raw_categories["Lahat ng patay na wika"] = { --TLCHANGE: "All extinct languages" --TLCHANGE description = "Nilalaman ng kategoryang ito ang mga kategorya ng lahat ng mga patay na wika sa Wiksiyonaryo.", additional = "Do not confuse this category with [[:Category:Extinct languages]], which is an umbrella category for the names of extinct languages in specific other languages (e.g. {{m+|de|Langobardisch}} for the ancient [[Lombardic]] language).", parents = { "Lahat ng wika", --TLCHANGE "All languages" }, english_name = "All extinct languages" --TLCHANGE } raw_categories["Wika ayon sa bansa"] = { --TLCHANGE "Languages by country" topright = "{{commonscat|Languages by continent}}", description = "Mga kategoryang grinugrupo ang mga wika ayon sa bansa.", --TLCHANGE additional = "{{{umbrella_meta_msg}}}", parents = { {name = "Lahat ng wika", sort = " "}, --TLCHANGE "All languages" }, english_name = "Languages by country" --TLCHANGE } raw_categories["Language isolates"] = { topright = "{{wikipedia|Language isolate}}\n{{commonscat|Language isolates}}", description = "Languages with no known relatives.", parents = { {name = "Languages by family", sort = "*Isolates"}, {name = "All language families", sort = "Isolates"}, }, } raw_categories["Languages not sorted into a location category"] = { description = "Languages which do not specify (in their {{tl|auto cat}} call) the location(s) where they are spoken.", additional = "This excludes constructed and reconstructed languages; as a result, all languages in this category explicitly specify their location as {{cd|UNKNOWN}}.", parents = { {name = "Requests"}, }, hidden = true, } ----------------------------------------------------------------------------- -- -- -- RAW HANDLERS -- -- -- ----------------------------------------------------------------------------- -- Given a category (without the "Category:" prefix), look up the page defining the category, find the call to -- {{auto cat}} (if any), and return a table of its arguments. If the category page doesn't exist or doesn't have -- an {{auto cat}} invocation, return nil. -- -- FIXME: Duplicated in [[Module:category tree/lects]]. local function scrape_category_for_auto_cat_args(cat) local cat_page = mw.title.new("Category:" .. cat) if cat_page then local contents = cat_page:getContent() if contents then local frame = mw.getCurrentFrame() for template in require("Module:template parser").find_templates(contents) do -- The template parser automatically handles redirects and canonicalizes them, so uses of {{autocat}} -- will also be found. if template:get_name() == "auto cat" then return template:get_arguments() end end end end return nil end local function link_location(location) local location_no_the = location:match("^the (.*)$") local bare_location = location_no_the or location local location_link local bare_location_parts = split(bare_location, ", ") for i, part in ipairs(bare_location_parts) do bare_location_parts[i] = ("[[%s]]"):format(part) end location_link = concat(bare_location_parts, ", ") if location_no_the then location_link = "the " .. location_link end return location_link end local function linkbox(lang, setwiki, setwikt, setsister, entryname) local wiktionarylinks = {} local canonicalName = lang:getCanonicalName() local wikimediaLanguages = lang:getWikimediaLanguages() local wikipediaArticle = setwiki or lang:getWikipediaArticle() setsister = setsister and ucfirst(setsister) or nil if setwikt then track("setwikt") if setwikt == "-" then track("setwikt/hyphen") end end if setwikt ~= "-" and wikimediaLanguages and wikimediaLanguages[1] then for _, wikimedialang in ipairs(wikimediaLanguages) do local check = new_title(wikimedialang:getCode() .. ":") if check and check.isExternal then insert(wiktionarylinks, (wikimedialang:getCanonicalName() ~= canonicalName and "(''" .. wikimedialang:getCanonicalName() .. "'') " or "") .. "'''[[:" .. wikimedialang:getCode() .. ":|" .. wikimedialang:getCode() .. ".wiktionary.org]]'''") end end wiktionarylinks = concat(wiktionarylinks, "<br/>") end local wikt_plural = wikimediaLanguages[2] and "s" or "" if #wiktionarylinks == 0 then wiktionarylinks = "''None.''" end if setsister then track("setsister") if setsister == "-" then track("setsister/hyphen") else setsister = "Category:" .. setsister end else setsister = lang:getCommonsCategory() or "-" end return concat{--TLCHANGE ALL OF THIS [=[<div class="wikitable" style="float: right; clear: right; margin: 0 0 0.5em 1em; width: 300px; padding: 5px;"> <div style="text-align: center; margin-bottom: 10px; margin-top: 5px">'''Mga kawing ng wikang ]=], canonicalName, [=['''</div> {| style="font-size: 90%" |- | style="vertical-align: top; height: 35px; border-bottom: 1px solid lightgray;" | [[File:Wikipedia-logo.png|35px|none|Wikipedia]] | style="border-bottom: 1px solid lightgray;" | May artikulo ang '''Tagalog Wikipedia''' sa: <div style="padding: 5px 10px">]=], (setwiki == "-" and "''None.''" or "'''[[w:" .. wikipediaArticle .. "|" .. wikipediaArticle .. "]]'''"), [=[</div> |- | style="vertical-align: top; height: 35px; border-bottom: 1px solid lightgray;" | [[File:Wikimedia-logo.svg|35px|none|Wikimedia Commons]] | style="border-bottom: 1px solid lightgray;" | May mga kawing ang '''Wikimedia Commons''' patungkol sa ]=], canonicalName, [=[ sa mga karatig-proyekto: <div style="padding: 5px 10px">]=], (setsister == "-" and "''None.''" or "'''[[commons:" .. setsister .. "|" .. setsister .. "]]'''"), [=[</div> |- | style="vertical-align: top; height: 35px; width: 40px; border-bottom: 1px solid lightgray;" | [[File:Wiktionary-logo-v2.svg|35px|none|Wiktionary]] |style="border-bottom: 1px solid lightgray;" | '''Edisyon ng Wiksiyonaryo''']=], wikt_plural, [=[ na isinulat sa ]=], canonicalName, [=[: <div style="padding: 5px 10px">]=], wiktionarylinks, [=[</div> |- | style="vertical-align: top; height: 35px; border-bottom: 1px solid lightgray;" | [[File:Open book nae 02.svg|35px|none|Entry]] | style="border-bottom: 1px solid lightgray;" | '''Entrada sa Wiksiyonaryo''' para sa itinagalog na ngalan nito: <div style="padding: 5px 10px">''']=], require("Module:links").full_link({lang = m_languages.getByCode("tl"), term = entryname or canonicalName}), [=['''</div> |- | style="vertical-align: top; height: 35px;" | [[File:Crystal kfind.png|35px|none|Considerations]] || '''Mga sanggunian sa Wiksiyonaryo''' para sa mga mag-aambag ng mga entradang ]=], canonicalName, [=[: <div style="padding: 5px 0"> * '''[[Wiksiyonaryo:]=], canonicalName, [=[ entry guidelines]]''' * '''[[:Kategorya:]=], canonicalName, [=[ na padrong pansangguni|Padrong pansangguni]] ({{PAGESINCAT:]=], canonicalName, [=[ na padrong pansangguni}})''' * '''[[Apendise:]=], canonicalName, [=[ bibliography|Bibliography]]''' |} </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 = {} insert(ret, '<table class="wikitable language-category-info"') local raw_data = lang:getData("extra") if raw_data then local replacements = { [1] = "canonical-name", [2] = "wikidata-item", [3] = "family", [4] = "scripts", } 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 compress = {compress = true} local function html_attribute_encode(str) str = to_json(str, compress) :gsub('"', "&quot;") -- & in attributes is automatically escaped. -- :gsub("&", "&amp;") :gsub("<", "&lt;") :gsub(">", "&gt;") return str end insert(ret, ' data-code="' .. lang:getCode() .. '"') for k, v in sorted_pairs(raw_data) do insert(ret, " data-" .. kebab_case(k) .. '="' .. html_attribute_encode(v) .. '"') end end insert(ret, '>\n') insert(ret, '<tr class="language-category-data">\n<th colspan="2">' .. edit_link(lang:getDataModuleName(), "<small>I-edit ang datos ng wika</small>") --TLCHANGE .. "</th>\n</tr>\n") --TLCHANGE ADD KWF OFFICIAL STATUS INDICATOR insert(ret, "<tr>\n<th>Canonical name</th><td>" .. lang:getCanonicalName() .. "</td>\n</tr>\n") if (lang:getData().is_official_kwf_name) then --add link to saved source insert(ret, "<tr>\n<th>Opisyal na pangalan</th><td><b>" .. lang:getCanonicalName() .. "</b><br/><span style='font-size: 0.7em'>(''ayon sa [[File:Komisyon sa Wikang Filipino (KWF).svg|20px|link=]] [" .. lang:getData().is_official_kwf_name .. " Komisyon sa Wikang Filipino]'')") else insert(ret, "<tr>\n<th>Kilalang pangalan</th><td><b>" .. lang:getCanonicalName().. "</b><br/><span style='font-size: 0.7em'>(''walang opisyal na pangalan ang [[File:Komisyon sa Wikang Filipino (KWF).svg|20px|link=]] Komisyon sa Wikang Filipino sa wikang ito'')") end --TLCHANGE add originating spanish name, if applicable local _spanish_name = nil if(lang:getData().spanish_name) then insert(ret, "<br/>(mula sa Espanyol na ''" .. lang:getData().spanish_name .. "'', binaybay alinsunod sa KWF Manwal sa Masinop na Pagsulat)") end insert(ret, "</span></td>\n</tr>\n") local otherNames = lang:getOtherNames() if otherNames then local names = {} for _, name in ipairs(otherNames) do insert(names, "<li>" .. name .. "</li>") end if #names > 0 then insert(ret, "<tr>\n<th>Ibang pangalan</th><td><ul>" .. concat(names, "\n") .. "</ul></td>\n</tr>\n") --TLCHANGE end end local aliases = lang:getAliases() if aliases then local names = {} for _, name in ipairs(aliases) do insert(names, "<li>" .. name .. "</li>") end if #names > 0 then insert(ret, "<tr>\n<th>Alyas</th><td><ul>" .. concat(names, "\n") .. "</ul></td>\n</tr>\n") --TLCHANGE end end local varieties = lang:getVarieties() if varieties then local names = {} for _, name in ipairs(varieties) do if type(name) == "string" then 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 insert(subvars, "<li>" .. var .. "</li>") end end if #subvars > 0 then insert(names, "<li><dl><dt>" .. first_var .. "</dt>\n<dd><ul>" .. concat(subvars, "\n") .. "</ul></dd></dl></li>") elseif first_var then insert(names, "<li>" .. first_var .. "</li>") end end end if #names > 0 then insert(ret, "<tr>\n<th>Varayti</th><td><ul>" .. concat(names, "\n") .. "</ul></td>\n</tr>\n") end end --TLCHANGE insert(ret, "<tr>\n<th>[[Wiktionary:Languages|Language code]]</th><td><code>" .. lang:getCode() .. "</code></td>\n</tr>\n") insert(ret, "<tr>\n<th>[[Wiksiyonaryo:Mga wika|Kodigo ng wika]]</th><td><code>" .. lang:getCode() .. "</code></td>\n</tr>\n") --TLCHANGE insert(ret, "<tr>\n<th>[[Wiktionary:Families|Language family]]</th>\n") insert(ret, "<tr>\n<th>[[Wiksiyonaryo:Mga pamilya|Pamilya ng wika]]</th>\n") local fam = lang:getFamily() local famCode = fam and fam:getCode() if not fam then insert(ret, "<td>unclassified</td>") elseif famCode == "qfa-iso" then insert(ret, "<td>[[:Category:Language isolates|language isolate]]</td>") elseif famCode == "qfa-mix" then insert(ret, "<td>[[:Category:Mixed languages|mixed language]]</td>") elseif famCode == "sgn" then insert(ret, "<td>[[:Category:Sign languages|sign language]]</td>") elseif famCode == "crp" then insert(ret, "<td>[[:Category:Creole or pidgin languages|creole or pidgin]]</td>") elseif famCode == "art" then insert(ret, "<td>[[:Category:Constructed languages|constructed language]]</td>") else insert(ret, "<td>" .. fam:makeCategoryLink() .. "</td>") end --TLCHANGE insert(ret, "\n</tr>\n<tr>\n<th>Ancestors</th>\n<td>") insert(ret, "\n</tr>\n<tr>\n<th>Mga ninuno</th>\n<td>") local ancestors = lang:getAncestors() if ancestors[2] then local ancestorList = {} for i, anc in ipairs(ancestors) do ancestorList[i] = "<li>" .. anc:makeCategoryLink() .. "</li>" end insert(ret, "<ul>\n" .. concat(ancestorList, "\n") .. "</ul>") else local ancestorChain = lang:getAncestorChainOld() if ancestorChain[1] then local chain = {} for _, anc in reverse_ipairs(ancestorChain) do insert(chain, "<li>" .. anc:makeCategoryLink() .. "</li>") end insert(ret, "<ul>\n" .. concat(chain, "\n<ul>\n") .. ("</ul>"):rep(#chain)) else insert(ret, "unknown") end end insert(ret, "</td>\n</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 "[[:Category:".. sc:getCategoryName() .. "|" .. sc:getCanonicalName() .. "]]" --TLCHANGE sc:makeCategoryLink() .. ' (<span class="plainlinks" title="Search for stylesheets referencing this script">[' .. url .. ' <code>' .. code .. '</code>]</span>)' end local function add_Hrkt(text) insert(text, "<li>" .. makeScriptLine(Hrkt)) insert(text, "<ul>") insert(text, "<li>" .. makeScriptLine(Hira) .. "</li>") insert(text, "<li>" .. makeScriptLine(Kana) .. "</li>") insert(text, "</ul>") insert(text, "</li>") end for _, sc in ipairs(scripts) do local text = {} local code = sc:getCode() if code == "Hrkt" then add_Hrkt(text) else insert(text, "<li>" .. makeScriptLine(sc)) if code == "Jpan" then insert(text, "<ul>") insert(text, "<li>" .. makeScriptLine(Hani) .. "</li>") add_Hrkt(text) insert(text, "</ul>") elseif code == "Kore" then insert(text, "<ul>") insert(text, "<li>" .. makeScriptLine(Hang) .. "</li>") insert(text, "<li>" .. makeScriptLine(Hani) .. "</li>") insert(text, "</ul>") end insert(text, "</li>") end insert(script_text, concat(text, "\n")) end --TLCHANGE insert(ret, "<tr>\n<th>[[Wiktionary:Scripts|Scripts]]</th>\n<td><ul>\n" .. concat(script_text, "\n") .. "</ul></td>\n</tr>\n") insert(ret, "<tr>\n<th>[[Wiksiyonaryo:Mga katitikan|Katitikan]]</th>\n<td><ul>\n" .. concat(script_text, "\n") .. "</ul></td>\n</tr>\n") else --TLCHANGE insert(ret, "<tr>\n<th>[[Wiktionary:Scripts|Scripts]]</th>\n<td>not specified</td>\n</tr>\n") insert(ret, "<tr>\n<th>[[Wiksiyonaryo:Mga katitikan|Katitikan]]</th>\n<td>hindi nakatala</td>\n</tr>\n") end local function add_module_info(raw_data, heading) if raw_data then local scripts = lang:getScriptCodes() local module_info, add = {}, false if type(raw_data) == "string" then insert(module_info, ("[[Module:%s]]"):format(raw_data)) add = true else local raw_data_type = type(raw_data) if raw_data_type == "table" and size(scripts) == 1 and type(raw_data[scripts[1]]) == "string" then insert(module_info, ("[[Module:%s]]"):format(raw_data[scripts[1]])) add = true elseif raw_data_type == "table" then insert(module_info, "<ul>") for script, data in sorted_pairs(raw_data) do if type(data) == "string" and m_sc_getByCode(script) then insert(module_info, ("<li><code>%s</code>: [[Module:%s]]</li>"):format(script, data)) end end insert(module_info, "</ul>") add = size(module_info) > 2 end end if add then insert(ret, [=[ <tr> <th>]=] .. heading .. [=[</th> <td>]=] .. concat(module_info) .. [=[</td> </tr> ]=]) end end end add_module_info(raw_data.generate_forms, "Form-generating<br>module") add_module_info(raw_data.translit, "[[Wiktionary:Transliteration and romanization|Transliteration<br>module]]") add_module_info(raw_data.display_text, "Display text<br>module") add_module_info(raw_data.entry_name, "Entry name<br>module") add_module_info(raw_data.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">Invalid Wikidata item: <code>' .. wikidataItem .. '</code></span>' end insert(ret, "<tr><th>Wikidata</th><td>" .. link .. "</td></tr>") end insert(ret, "</table>") return 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_topright_additional(lang, locations, 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 topright = linkbox(lang, setwiki, setwikt, setsister, entryname) --TLCHANGE local description = "Ito ang pangunahing kategorya ng '''" .. nameWithLanguage .. "'''." local location_links = {} local prep local saw_embedded_comma = false for _, location in ipairs(locations) do local this_prep if location == "the world" then this_prep = "across" insert(location_links, location) elseif location ~= "UNKNOWN" then this_prep = "sa" --TLCHANGE if location:find(",") then saw_embedded_comma = true end insert(location_links, link_location(location)) end if this_prep then if prep and this_prep ~= prep then error("Can't handle location 'the world' along with another location (clashing prepositions)") end prep = this_prep end end local location_desc if #location_links > 0 then local location_link_text if saw_embedded_comma and #location_links >= 3 then location_link_text = mw.text.listToText(location_links, "; ", "; at ") --TLCHANGE else location_link_text = serial_comma_join(location_links) end location_desc = ("%s %s %s.\n\n"):format( --TLCHANGE extinct and "Ito'y isang patay na wikang dating isinasalita" or "Isinasalita ito", prep, location_link_text) --TLCHANGE elseif extinct then location_desc = "It is an [[extinct language]].\n\n" else location_desc = "" end local add = location_desc .. "Impormasyon patungkol sa " .. 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 = new_title("Wiktionary:About " .. canonicalName) if about.exists then add = add .. "\n\n" .. "Please see '''[[Wiktionary:About " .. canonicalName .. "]]''' for information and special considerations for creating " .. nameWithLanguage .. " entries." 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, "Puno ng pamilya") --TLCHANGE "Family tree") 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, topright, add end local function get_parents(lang, locations, extinct) local canonicalName = lang:getCanonicalName() local sortkey = {sort_base = canonicalName, lang = "tl"} --TLCHANGE "en" local ret = {{name = "Lahat ng wika", sort = sortkey}} --TLCHANGE "All languages" 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 insert(ret, {name = "Category:Unclassified languages", sort = sortkey}) elseif famCode == "qfa-iso" then insert(ret, {name = "Category:Language isolates", sort = sortkey}) elseif famCode == "qfa-mix" then insert(ret, {name = "Category:Mixed languages", sort = sortkey}) elseif famCode == "sgn" then insert(ret, {name = "Category:All sign languages", sort = sortkey}) elseif famCode == "crp" then insert(ret, {name = "Category:Creole or pidgin languages", sort = sortkey}) 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:getFullCode() == lang:getCode() then for _, anc_extra in ipairs(anc:getAncestors()) do insert(ret, {name = "Category:" .. ucfirst(anc_extra:getFullName()) .. "-based creole or pidgin languages", sort = sortkey}) end else insert(ret, {name = "Category:" .. ucfirst(anc:getFullName()) .. "-based creole or pidgin languages", sort = sortkey}) end end elseif famCode == "art" then if lang:hasType("appendix-constructed") then insert(ret, {name = "Category:Appendix-only constructed languages", sort = sortkey}) else insert(ret, {name = "Category:Mga wikang nilikha", sort = sortkey}) --TLCHANGE "Category:Constructed languages" "Artificial languages" is a different category end for _, anc in ipairs(lang:getAncestors()) do if anc:getFullCode() == lang:getCode() then for _, anc_extra in ipairs(anc:getAncestors()) do insert(ret, {name = "Category:" .. ucfirst(anc_extra:getFullName()) .. "-based constructed languages", sort = sortkey}) end else insert(ret, {name = "Category:" .. ucfirst(anc:getFullName()) .. "-based constructed languages", sort = sortkey}) end end else insert(ret, {name = "Category:" .. fam:getCategoryName(), sort = sortkey}) if lang:hasType("reconstructed") then insert(ret, { name = "Category:Reconstructed languages", sort = {sort_base = canonicalName:gsub("^Proto%-", ""), lang = "en"} }) end end local function add_sc_cat(sc) insert(ret, {name = "Category:" .. sc:getCategoryName() .. " na wika", sort = sortkey}) --TLCHANGE for scripts, example "Katitikang Latino na wika" sc:getCategoryName() .. " languages" end local function add_Hrkt() add_sc_cat(Hrkt) add_sc_cat(Hira) add_sc_cat(Kana) end for _, sc in ipairs(lang:getScripts()) do if sc:getCode() == "Hrkt" then add_Hrkt() else add_sc_cat(sc) if sc:getCode() == "Jpan" then add_sc_cat(Hani) add_Hrkt() elseif sc:getCode() == "Kore" then add_sc_cat(Hang) add_sc_cat(Hani) end end end if lang:hasTranslit() then insert(ret, {name = "Category:Languages with automatic transliteration", sort = sortkey}) end local function insert_location_language_cat(location) local cat = "Mga wika ng " .. location --TLCHANGE "Languages of " .. location insert(ret, {name = "Category:" .. cat, sort = sortkey}) local auto_cat_args = scrape_category_for_auto_cat_args(cat) local location_parent = auto_cat_args and auto_cat_args.parent if location_parent then local split_parents = require(parse_utilities_module).split_on_comma(location_parent) for _, parent in ipairs(split_parents) do parent = parent:match("^(.-):.*$") or parent insert_location_language_cat(parent) end end end local saw_location = false for _, location in ipairs(locations) do if location ~= "UNKNOWN" then saw_location = true insert_location_language_cat(location) end end if extinct then insert(ret, {name = "Category:All extinct languages", sort = sortkey}) end if not saw_location and not (lang:hasType("reconstructed") or (fam and fam:getCode() == "art")) then -- Constructed and reconstructed languages don't need a location specified and often won't have one, -- so don't put them in this maintenance category. insert(ret, {name = "Category:Languages not sorted into a location category", sort = sortkey}) end return ret end local function get_children() local ret = {} -- FIXME: We should work on the children mechanism so it isn't necessary to manually specify these. -- TLCHANGE: for _, label in ipairs({"appendices", "entry maintenance", "lemmas", "names", "phrases", "rhymes", "symbols", "templates", "terms by etymology", "terms by usage"}) do for _, label in ipairs({"na apendise", "na entradang pinapanatili", "na lema", "na pangalan", "na parirala", "na tugma", "na simbolo", "na padron", "na salita ayon sa etimolohiya", "na salita ayon sa paggamit"}) do insert(ret, {name = label, is_label = true}) end insert(ret, {name = "na salitang hinango mula sa {{{langname}}}", is_label = true, lang = false}) --TLCHANGE "terms derived from {{{langname}}}" insert(ret, {name = "{{{langcode}}}:Lahat ng paksa", sort = "all topics"}) --TLCHANGE All topics insert(ret, {name = "Varayti ng {{{langname}}}"}) --TLCHANGE insert(ret, {name = "Requests concerning {{{langname}}}"}) insert(ret, {name = "Rhymes:{{{langname}}}", description = "Lists of {{{langname}}} words by their rhymes."}) insert(ret, {name = "User {{{langcode}}}", description = "Wiktionary users categorized by fluency levels in {{{langdisp}}}."}) return ret end -- Handle language categories of the form e.g. [[:Category:French language]] and -- [[:Category:British Sign Language]]. insert(raw_handlers, function(data) local category = data.category -- TLCHANGE: if not (category:match("[Ll]anguage$") or category:match("[Ll]ect$")) then if not (category:match("^[Ww]ika") or category:match("[Ll]ect$")) then return nil end local lang = m_languages.getByCanonicalName(category) if not lang then local langname = category:match("^Wikang (.*)") --TLCHANGE if langname then lang = m_languages.getByCanonicalName(langname) end if not lang then return nil end end local args = require("Module:parameters").process(data.args, { [1] = {list = true}, ["setwiki"] = true, ["setwikt"] = true, ["setsister"] = true, ["entryname"] = true, ["extinct"] = {type = "boolean"}, }) -- 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[1] == 0 and not data.called_from_inside then -- At least one location 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 location (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, topright, 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, topright, additional = get_description_topright_additional( lang, args[1], args.extinct, args.setwiki, args.setwikt, args.setsister, args.entryname ) end return { canonical_name = lang:getCategoryName(), description = description, lang = lang:getCode(), topright = topright, additional = additional, breadcrumb = lang:getCanonicalName(), parents = get_parents(lang, args[1], args.extinct), extra_children = get_children(lang), umbrella = false, can_be_empty = true, english_name = " language" --TLCHANGE }, true end) -- Handle categories such as [[:Category:Languages of Indonesia]]. insert(raw_handlers, function(data) local location = data.category:match("^Mga wika ng (.*)$") --TLCHANGE "^Languages of (.*)$" if location then local args = require("Module:parameters").process(data.args, { ["flagfile"] = true, ["commonscat"] = true, ["wp"] = true, ["basename"] = true, ["parent"] = true, ["locationcat"] = true, ["locationlink"] = true, }) local topright local basename = args.basename or location:gsub(", .*", "") if args.flagfile ~= "-" then local flagfile_arg = args.flagfile or ("Flag of %s.svg"):format(basename) local files = require(parse_utilities_module).split_on_comma(flagfile_arg) local topright_parts = {} for _, file in ipairs(files) do local flagfile = "File:" .. file local flagfile_page = new_title(flagfile) if flagfile_page and flagfile_page.file.exists then insert(topright_parts, ("[[%s|right|100px|border]]"):format(flagfile)) elseif args.flagfile then error(("Explicit flagfile '%s' doesn't exist"):format(flagfile)) end end topright = concat(topright_parts) end if args.wp then local wp = require("Module:yesno")(args.wp, "+") if wp == "+" or wp == true then wp = data.category end if wp then local wp_topright = ("{{wikipedia|%s}}"):format(wp) if topright then topright = topright .. wp_topright else topright = wp_topright end end end if args.commonscat then local commonscat = require("Module:yesno")(args.commonscat, "+") if commonscat == "+" or commonscat == true then commonscat = data.category end if commonscat then local commons_topright = ("{{commonscat|%s}}"):format(commonscat) if topright then topright = topright .. commons_topright else topright = commons_topright end end end local bare_location = location:match("^the (.*)$") or location local location_link = args.locationlink or link_location(location) local bare_basename = basename:match("^the (.*)$") or basename local parents = {} if args.parent then local explicit_parents = require(parse_utilities_module).split_on_comma(args.parent) for i, parent in ipairs(explicit_parents) do local actual_parent, sort_key = parent:match("^(.-):(.*)$") if actual_parent then parent = actual_parent sort_key = sort_key:gsub("%+", bare_location) else sort_key = " " .. bare_location end insert(parents, {name = "Mga wika ng " .. parent, sort = sort_key}) --TLCHANGE end else insert(parents, {name = "Wika ayon sa bansa", sort = {sort_base = bare_location, lang = "en"}}) --TLCHANGE end if args.locationcat then local explicit_location_cats = require(parse_utilities_module).split_on_comma(args.locationcat) for i, locationcat in ipairs(explicit_location_cats) do insert(parents, {name = "Category:" .. locationcat, sort = " Languages"}) end else local location_cat = ("Category:%s"):format(bare_location) local location_page = new_title(location_cat) if location_page and location_page.exists then insert(parents, {name = location_cat, sort = "Languages"}) end end local description = ("Mga kategorya sa mga wika ng %s (pati ang mga sublect)."):format(location_link) --TLCHANGE "Categories for languages of %s (including sublects)." return { topright = topright, description = description, parents = parents, breadcrumb = bare_basename, additional = "{{{umbrella_msg}}}", english_name = "Languages of " .. basename --TLCHANGE }, true end end) -- Handle categories such as [[:Category:English-based creole or pidgin languages]]. insert(raw_handlers, function(data) local langname = data.category:match("(.*)%-based creole or pidgin languages$") if langname then local lang = m_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 = {sort_base = "*" .. langname, lang = "en"}}}, breadcrumb = lang:getCanonicalName() .. "-based", } end end end) -- Handle categories such as [[:Category:English-based constructed languages]]. insert(raw_handlers, function(data) local langname = data.category:match("(.*)%-based constructed languages$") if langname then local lang = m_languages.getByCanonicalName(langname) if lang then return { lang = lang:getCode(), description = "Constructed languages which are based on " .. lang:makeCategoryLink() .. ".", parents = {{name = "Constructed languages", sort = {sort_base = "*" .. langname, lang = "en"}}}, breadcrumb = lang:getCanonicalName() .. "-based", } end end end) return {RAW_CATEGORIES = raw_categories, RAW_HANDLERS = raw_handlers} hrhmzwlrzm5zkolv20mr4nhk6k1f4tq 176625 176624 2026-04-24T09:02:07Z Yivan000 4078 176625 Scribunto text/plain local new_title = mw.title.new local ucfirst = require("Module:string utilities").ucfirst local split = require("Module:string utilities").split local raw_categories = {} local raw_handlers = {} local m_languages = require("Module:languages") local m_sc_getByCode = require("Module:scripts").getByCode local m_table = require("Module:table") local parse_utilities_module = "Module:parse utilities" local concat = table.concat local insert = table.insert local reverse_ipairs = m_table.reverseIpairs local serial_comma_join = m_table.serialCommaJoin local size = m_table.size local sorted_pairs = m_table.sortedPairs local to_json = require("Module:JSON").toJSON local Hang = m_sc_getByCode("Hang") local Hani = m_sc_getByCode("Hani") local Hira = m_sc_getByCode("Hira") local Hrkt = m_sc_getByCode("Hrkt") local Kana = m_sc_getByCode("Kana") local function track(page) -- [[Special:WhatLinksHere/Wiktionary:Tracking/category tree/languages/PAGE]] return require("Module:debug/track")("category tree/languages/" .. page) end -- This handles language categories of the form e.g. [[:Category:French language]] and -- [[:Category:British Sign Language]]; categories like [[:Category:Languages of Indonesia]]; categories like -- [[:Category:English-based creole or pidgin languages]]; and categories like -- [[:Category:English-based constructed languages]]. ----------------------------------------------------------------------------- -- -- -- RAW CATEGORIES -- -- -- ----------------------------------------------------------------------------- raw_categories["Lahat ng wika"] = { --TLCHANGE "All languages" topright = "{{commonscat|Languages}}\n[[File:Languages world map-transparent background.svg|thumb|right|250px|Rough world map of language families]]", --TLCHANGE description = "Nilalaman ng kategoryang ito ang mga kategorya ng lahat ng wika sa Wiksiyonaryo.", additional = "Hindi lahat ng mga maaaring wika sa Wiksiyonaryo ay nandito. Maraming mga iba na hindi " .. "pa nabibigyan ng atensyon sa mga editor, marahil dahil hindi lahat ng gumagamit ng Wiksiyonaryo ay marunong sa lahat ng wika." .. "Tignan ang [[Wiksiyonaryo:Listahan ng mga wika]] para sa kumpletong listahan.", parents = { "Pangkalahatan", --TLCHANGE "Fundamental", }, english_name = "All languages" --TLCHANGE } raw_categories["Lahat ng patay na wika"] = { --TLCHANGE: "All extinct languages" --TLCHANGE description = "Nilalaman ng kategoryang ito ang mga kategorya ng lahat ng mga patay na wika sa Wiksiyonaryo.", additional = "Do not confuse this category with [[:Category:Extinct languages]], which is an umbrella category for the names of extinct languages in specific other languages (e.g. {{m+|de|Langobardisch}} for the ancient [[Lombardic]] language).", parents = { "Lahat ng wika", --TLCHANGE "All languages" }, english_name = "All extinct languages" --TLCHANGE } raw_categories["Wika ayon sa bansa"] = { --TLCHANGE "Languages by country" topright = "{{commonscat|Languages by continent}}", description = "Mga kategoryang grinugrupo ang mga wika ayon sa bansa.", --TLCHANGE additional = "{{{umbrella_meta_msg}}}", parents = { {name = "Lahat ng wika", sort = " "}, --TLCHANGE "All languages" }, english_name = "Languages by country" --TLCHANGE } raw_categories["Language isolates"] = { topright = "{{wikipedia|Language isolate}}\n{{commonscat|Language isolates}}", description = "Languages with no known relatives.", parents = { {name = "Languages by family", sort = "*Isolates"}, {name = "All language families", sort = "Isolates"}, }, } raw_categories["Languages not sorted into a location category"] = { description = "Languages which do not specify (in their {{tl|auto cat}} call) the location(s) where they are spoken.", additional = "This excludes constructed and reconstructed languages; as a result, all languages in this category explicitly specify their location as {{cd|UNKNOWN}}.", parents = { {name = "Requests"}, }, hidden = true, } ----------------------------------------------------------------------------- -- -- -- RAW HANDLERS -- -- -- ----------------------------------------------------------------------------- -- Given a category (without the "Category:" prefix), look up the page defining the category, find the call to -- {{auto cat}} (if any), and return a table of its arguments. If the category page doesn't exist or doesn't have -- an {{auto cat}} invocation, return nil. -- -- FIXME: Duplicated in [[Module:category tree/lects]]. local function scrape_category_for_auto_cat_args(cat) local cat_page = mw.title.new("Category:" .. cat) if cat_page then local contents = cat_page:getContent() if contents then local frame = mw.getCurrentFrame() for template in require("Module:template parser").find_templates(contents) do -- The template parser automatically handles redirects and canonicalizes them, so uses of {{autocat}} -- will also be found. if template:get_name() == "auto cat" then return template:get_arguments() end end end end return nil end local function link_location(location) local location_no_the = location:match("^the (.*)$") local bare_location = location_no_the or location local location_link local bare_location_parts = split(bare_location, ", ") for i, part in ipairs(bare_location_parts) do bare_location_parts[i] = ("[[%s]]"):format(part) end location_link = concat(bare_location_parts, ", ") if location_no_the then location_link = "the " .. location_link end return location_link end local function linkbox(lang, setwiki, setwikt, setsister, entryname) local wiktionarylinks = {} local canonicalName = lang:getCanonicalName() local wikimediaLanguages = lang:getWikimediaLanguages() local wikipediaArticle = setwiki or lang:getWikipediaArticle() setsister = setsister and ucfirst(setsister) or nil if setwikt then track("setwikt") if setwikt == "-" then track("setwikt/hyphen") end end if setwikt ~= "-" and wikimediaLanguages and wikimediaLanguages[1] then for _, wikimedialang in ipairs(wikimediaLanguages) do local check = new_title(wikimedialang:getCode() .. ":") if check and check.isExternal then insert(wiktionarylinks, (wikimedialang:getCanonicalName() ~= canonicalName and "(''" .. wikimedialang:getCanonicalName() .. "'') " or "") .. "'''[[:" .. wikimedialang:getCode() .. ":|" .. wikimedialang:getCode() .. ".wiktionary.org]]'''") end end wiktionarylinks = concat(wiktionarylinks, "<br/>") end local wikt_plural = wikimediaLanguages[2] and "s" or "" if #wiktionarylinks == 0 then wiktionarylinks = "''None.''" end if setsister then track("setsister") if setsister == "-" then track("setsister/hyphen") else setsister = "Category:" .. setsister end else setsister = lang:getCommonsCategory() or "-" end return concat{--TLCHANGE ALL OF THIS [=[<div class="wikitable" style="float: right; clear: right; margin: 0 0 0.5em 1em; width: 300px; padding: 5px;"> <div style="text-align: center; margin-bottom: 10px; margin-top: 5px">'''Mga kawing ng wikang ]=], canonicalName, [=['''</div> {| style="font-size: 90%" |- | style="vertical-align: top; height: 35px; border-bottom: 1px solid lightgray;" | [[File:Wikipedia-logo.png|35px|none|Wikipedia]] | style="border-bottom: 1px solid lightgray;" | May artikulo ang '''Tagalog Wikipedia''' sa: <div style="padding: 5px 10px">]=], (setwiki == "-" and "''None.''" or "'''[[w:" .. wikipediaArticle .. "|" .. wikipediaArticle .. "]]'''"), [=[</div> |- | style="vertical-align: top; height: 35px; border-bottom: 1px solid lightgray;" | [[File:Wikimedia-logo.svg|35px|none|Wikimedia Commons]] | style="border-bottom: 1px solid lightgray;" | May mga kawing ang '''Wikimedia Commons''' patungkol sa ]=], canonicalName, [=[ sa mga karatig-proyekto: <div style="padding: 5px 10px">]=], (setsister == "-" and "''None.''" or "'''[[commons:" .. setsister .. "|" .. setsister .. "]]'''"), [=[</div> |- | style="vertical-align: top; height: 35px; width: 40px; border-bottom: 1px solid lightgray;" | [[File:Wiktionary-logo-v2.svg|35px|none|Wiktionary]] |style="border-bottom: 1px solid lightgray;" | '''Edisyon ng Wiksiyonaryo''']=], wikt_plural, [=[ na isinulat sa ]=], canonicalName, [=[: <div style="padding: 5px 10px">]=], wiktionarylinks, [=[</div> |- | style="vertical-align: top; height: 35px; border-bottom: 1px solid lightgray;" | [[File:Open book nae 02.svg|35px|none|Entry]] | style="border-bottom: 1px solid lightgray;" | '''Entrada sa Wiksiyonaryo''' para sa itinagalog na ngalan nito: <div style="padding: 5px 10px">''']=], require("Module:links").full_link({lang = m_languages.getByCode("tl"), term = entryname or canonicalName}), [=['''</div> |- | style="vertical-align: top; height: 35px;" | [[File:Crystal kfind.png|35px|none|Considerations]] || '''Mga sanggunian sa Wiksiyonaryo''' para sa mga mag-aambag ng mga entradang ]=], canonicalName, [=[: <div style="padding: 5px 0"> * '''[[Wiksiyonaryo:]=], canonicalName, [=[ entry guidelines]]''' * '''[[:Kategorya:]=], canonicalName, [=[ na padrong pansangguni|Padrong pansangguni]] ({{PAGESINCAT:]=], canonicalName, [=[ na padrong pansangguni}})''' * '''[[Apendise:]=], canonicalName, [=[ bibliography|Bibliography]]''' |} </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 = {} insert(ret, '<table class="wikitable language-category-info"') local raw_data = lang:getData("extra") if raw_data then local replacements = { [1] = "canonical-name", [2] = "wikidata-item", [3] = "family", [4] = "scripts", } 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 compress = {compress = true} local function html_attribute_encode(str) str = to_json(str, compress) :gsub('"', "&quot;") -- & in attributes is automatically escaped. -- :gsub("&", "&amp;") :gsub("<", "&lt;") :gsub(">", "&gt;") return str end insert(ret, ' data-code="' .. lang:getCode() .. '"') for k, v in sorted_pairs(raw_data) do insert(ret, " data-" .. kebab_case(k) .. '="' .. html_attribute_encode(v) .. '"') end end insert(ret, '>\n') insert(ret, '<tr class="language-category-data">\n<th colspan="2">' .. edit_link(lang:getDataModuleName(), "<small>I-edit ang datos ng wika</small>") --TLCHANGE .. "</th>\n</tr>\n") --TLCHANGE ADD KWF OFFICIAL STATUS INDICATOR insert(ret, "<tr>\n<th>Canonical name</th><td>" .. lang:getCanonicalName() .. "</td>\n</tr>\n") if (lang:getData().is_official_kwf_name) then --add link to saved source insert(ret, "<tr>\n<th>Opisyal na pangalan</th><td><b>" .. lang:getCanonicalName() .. "</b><br/><span style='font-size: 0.7em'>(''ayon sa [[File:Komisyon sa Wikang Filipino (KWF).svg|20px|link=]] [" .. lang:getData().is_official_kwf_name .. " Komisyon sa Wikang Filipino]'')") else insert(ret, "<tr>\n<th>Kilalang pangalan</th><td><b>" .. lang:getCanonicalName().. "</b><br/><span style='font-size: 0.7em'>(''walang opisyal na pangalan ang [[File:Komisyon sa Wikang Filipino (KWF).svg|20px|link=]] Komisyon sa Wikang Filipino sa wikang ito'')") end --TLCHANGE add originating spanish name, if applicable local _spanish_name = nil if(lang:getData().spanish_name) then insert(ret, "<br/>(mula sa Espanyol na ''" .. lang:getData().spanish_name .. "'', binaybay alinsunod sa KWF Manwal sa Masinop na Pagsulat)") end insert(ret, "</span></td>\n</tr>\n") local otherNames = lang:getOtherNames() if otherNames then local names = {} for _, name in ipairs(otherNames) do insert(names, "<li>" .. name .. "</li>") end if #names > 0 then insert(ret, "<tr>\n<th>Ibang pangalan</th><td><ul>" .. concat(names, "\n") .. "</ul></td>\n</tr>\n") --TLCHANGE end end local aliases = lang:getAliases() if aliases then local names = {} for _, name in ipairs(aliases) do insert(names, "<li>" .. name .. "</li>") end if #names > 0 then insert(ret, "<tr>\n<th>Alyas</th><td><ul>" .. concat(names, "\n") .. "</ul></td>\n</tr>\n") --TLCHANGE end end local varieties = lang:getVarieties() if varieties then local names = {} for _, name in ipairs(varieties) do if type(name) == "string" then 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 insert(subvars, "<li>" .. var .. "</li>") end end if #subvars > 0 then insert(names, "<li><dl><dt>" .. first_var .. "</dt>\n<dd><ul>" .. concat(subvars, "\n") .. "</ul></dd></dl></li>") elseif first_var then insert(names, "<li>" .. first_var .. "</li>") end end end if #names > 0 then insert(ret, "<tr>\n<th>Varayti</th><td><ul>" .. concat(names, "\n") .. "</ul></td>\n</tr>\n") end end --TLCHANGE insert(ret, "<tr>\n<th>[[Wiktionary:Languages|Language code]]</th><td><code>" .. lang:getCode() .. "</code></td>\n</tr>\n") insert(ret, "<tr>\n<th>[[Wiksiyonaryo:Mga wika|Kodigo ng wika]]</th><td><code>" .. lang:getCode() .. "</code></td>\n</tr>\n") --TLCHANGE insert(ret, "<tr>\n<th>[[Wiktionary:Families|Language family]]</th>\n") insert(ret, "<tr>\n<th>[[Wiksiyonaryo:Mga pamilya|Pamilya ng wika]]</th>\n") local fam = lang:getFamily() local famCode = fam and fam:getCode() if not fam then insert(ret, "<td>unclassified</td>") elseif famCode == "qfa-iso" then insert(ret, "<td>[[:Category:Language isolates|language isolate]]</td>") elseif famCode == "qfa-mix" then insert(ret, "<td>[[:Category:Mixed languages|mixed language]]</td>") elseif famCode == "sgn" then insert(ret, "<td>[[:Category:Sign languages|sign language]]</td>") elseif famCode == "crp" then insert(ret, "<td>[[:Category:Creole or pidgin languages|creole or pidgin]]</td>") elseif famCode == "art" then insert(ret, "<td>[[:Category:Constructed languages|constructed language]]</td>") else insert(ret, "<td>" .. fam:makeCategoryLink() .. "</td>") end --TLCHANGE insert(ret, "\n</tr>\n<tr>\n<th>Ancestors</th>\n<td>") insert(ret, "\n</tr>\n<tr>\n<th>Mga ninuno</th>\n<td>") local ancestors = lang:getAncestors() if ancestors[2] then local ancestorList = {} for i, anc in ipairs(ancestors) do ancestorList[i] = "<li>" .. anc:makeCategoryLink() .. "</li>" end insert(ret, "<ul>\n" .. concat(ancestorList, "\n") .. "</ul>") else local ancestorChain = lang:getAncestorChainOld() if ancestorChain[1] then local chain = {} for _, anc in reverse_ipairs(ancestorChain) do insert(chain, "<li>" .. anc:makeCategoryLink() .. "</li>") end insert(ret, "<ul>\n" .. concat(chain, "\n<ul>\n") .. ("</ul>"):rep(#chain)) else insert(ret, "unknown") end end insert(ret, "</td>\n</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 "[[:Category:".. sc:getCategoryName() .. "|" .. sc:getCanonicalName() .. "]]" --TLCHANGE sc:makeCategoryLink() .. ' (<span class="plainlinks" title="Search for stylesheets referencing this script">[' .. url .. ' <code>' .. code .. '</code>]</span>)' end local function add_Hrkt(text) insert(text, "<li>" .. makeScriptLine(Hrkt)) insert(text, "<ul>") insert(text, "<li>" .. makeScriptLine(Hira) .. "</li>") insert(text, "<li>" .. makeScriptLine(Kana) .. "</li>") insert(text, "</ul>") insert(text, "</li>") end for _, sc in ipairs(scripts) do local text = {} local code = sc:getCode() if code == "Hrkt" then add_Hrkt(text) else insert(text, "<li>" .. makeScriptLine(sc)) if code == "Jpan" then insert(text, "<ul>") insert(text, "<li>" .. makeScriptLine(Hani) .. "</li>") add_Hrkt(text) insert(text, "</ul>") elseif code == "Kore" then insert(text, "<ul>") insert(text, "<li>" .. makeScriptLine(Hang) .. "</li>") insert(text, "<li>" .. makeScriptLine(Hani) .. "</li>") insert(text, "</ul>") end insert(text, "</li>") end insert(script_text, concat(text, "\n")) end --TLCHANGE insert(ret, "<tr>\n<th>[[Wiktionary:Scripts|Scripts]]</th>\n<td><ul>\n" .. concat(script_text, "\n") .. "</ul></td>\n</tr>\n") insert(ret, "<tr>\n<th>[[Wiksiyonaryo:Mga katitikan|Katitikan]]</th>\n<td><ul>\n" .. concat(script_text, "\n") .. "</ul></td>\n</tr>\n") else --TLCHANGE insert(ret, "<tr>\n<th>[[Wiktionary:Scripts|Scripts]]</th>\n<td>not specified</td>\n</tr>\n") insert(ret, "<tr>\n<th>[[Wiksiyonaryo:Mga katitikan|Katitikan]]</th>\n<td>hindi nakatala</td>\n</tr>\n") end local function add_module_info(raw_data, heading) if raw_data then local scripts = lang:getScriptCodes() local module_info, add = {}, false if type(raw_data) == "string" then insert(module_info, ("[[Module:%s]]"):format(raw_data)) add = true else local raw_data_type = type(raw_data) if raw_data_type == "table" and size(scripts) == 1 and type(raw_data[scripts[1]]) == "string" then insert(module_info, ("[[Module:%s]]"):format(raw_data[scripts[1]])) add = true elseif raw_data_type == "table" then insert(module_info, "<ul>") for script, data in sorted_pairs(raw_data) do if type(data) == "string" and m_sc_getByCode(script) then insert(module_info, ("<li><code>%s</code>: [[Module:%s]]</li>"):format(script, data)) end end insert(module_info, "</ul>") add = size(module_info) > 2 end end if add then insert(ret, [=[ <tr> <th>]=] .. heading .. [=[</th> <td>]=] .. concat(module_info) .. [=[</td> </tr> ]=]) end end end add_module_info(raw_data.generate_forms, "Form-generating<br>module") add_module_info(raw_data.translit, "[[Wiktionary:Transliteration and romanization|Transliteration<br>module]]") add_module_info(raw_data.display_text, "Display text<br>module") add_module_info(raw_data.entry_name, "Entry name<br>module") add_module_info(raw_data.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">Invalid Wikidata item: <code>' .. wikidataItem .. '</code></span>' end insert(ret, "<tr><th>Wikidata</th><td>" .. link .. "</td></tr>") end insert(ret, "</table>") return 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_topright_additional(lang, locations, 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 topright = linkbox(lang, setwiki, setwikt, setsister, entryname) --TLCHANGE local description = "Ito ang pangunahing kategorya ng '''" .. nameWithLanguage .. "'''." local location_links = {} local prep local saw_embedded_comma = false for _, location in ipairs(locations) do local this_prep if location == "the world" then this_prep = "across" insert(location_links, location) elseif location ~= "UNKNOWN" then this_prep = "sa" --TLCHANGE if location:find(",") then saw_embedded_comma = true end insert(location_links, link_location(location)) end if this_prep then if prep and this_prep ~= prep then error("Can't handle location 'the world' along with another location (clashing prepositions)") end prep = this_prep end end local location_desc if #location_links > 0 then local location_link_text if saw_embedded_comma and #location_links >= 3 then location_link_text = mw.text.listToText(location_links, "; ", "; at ") --TLCHANGE else location_link_text = serial_comma_join(location_links) end location_desc = ("%s %s %s.\n\n"):format( --TLCHANGE extinct and "Ito'y isang patay na wikang dating isinasalita" or "Isinasalita ito", prep, location_link_text) --TLCHANGE elseif extinct then location_desc = "It is an [[extinct language]].\n\n" else location_desc = "" end local add = location_desc .. "Impormasyon patungkol sa " .. 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 = new_title("Wiktionary:About " .. canonicalName) if about.exists then add = add .. "\n\n" .. "Please see '''[[Wiktionary:About " .. canonicalName .. "]]''' for information and special considerations for creating " .. nameWithLanguage .. " entries." 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, "Puno ng pamilya") --TLCHANGE "Family tree") 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, topright, add end local function get_parents(lang, locations, extinct) local canonicalName = lang:getCanonicalName() local sortkey = {sort_base = canonicalName, lang = "tl"} --TLCHANGE "en" local ret = {{name = "Lahat ng wika", sort = sortkey}} --TLCHANGE "All languages" 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 insert(ret, {name = "Category:Unclassified languages", sort = sortkey}) elseif famCode == "qfa-iso" then insert(ret, {name = "Category:Language isolates", sort = sortkey}) elseif famCode == "qfa-mix" then insert(ret, {name = "Category:Mixed languages", sort = sortkey}) elseif famCode == "sgn" then insert(ret, {name = "Category:All sign languages", sort = sortkey}) elseif famCode == "crp" then insert(ret, {name = "Category:Creole or pidgin languages", sort = sortkey}) 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:getFullCode() == lang:getCode() then for _, anc_extra in ipairs(anc:getAncestors()) do insert(ret, {name = "Category:" .. ucfirst(anc_extra:getFullName()) .. "-based creole or pidgin languages", sort = sortkey}) end else insert(ret, {name = "Category:" .. ucfirst(anc:getFullName()) .. "-based creole or pidgin languages", sort = sortkey}) end end elseif famCode == "art" then if lang:hasType("appendix-constructed") then insert(ret, {name = "Category:Appendix-only constructed languages", sort = sortkey}) else insert(ret, {name = "Category:Mga wikang nilikha", sort = sortkey}) --TLCHANGE "Category:Constructed languages" "Artificial languages" is a different category end for _, anc in ipairs(lang:getAncestors()) do if anc:getFullCode() == lang:getCode() then for _, anc_extra in ipairs(anc:getAncestors()) do insert(ret, {name = "Category:" .. ucfirst(anc_extra:getFullName()) .. "-based constructed languages", sort = sortkey}) end else insert(ret, {name = "Category:" .. ucfirst(anc:getFullName()) .. "-based constructed languages", sort = sortkey}) end end else insert(ret, {name = "Category:" .. fam:getCategoryName(), sort = sortkey}) if lang:hasType("reconstructed") then insert(ret, { name = "Category:Reconstructed languages", sort = {sort_base = canonicalName:gsub("^Proto%-", ""), lang = "en"} }) end end local function add_sc_cat(sc) insert(ret, {name = "Category:" .. sc:getCategoryName() .. " na wika", sort = sortkey}) --TLCHANGE for scripts, example "Katitikang Latino na wika" sc:getCategoryName() .. " languages" end local function add_Hrkt() add_sc_cat(Hrkt) add_sc_cat(Hira) add_sc_cat(Kana) end for _, sc in ipairs(lang:getScripts()) do if sc:getCode() == "Hrkt" then add_Hrkt() else add_sc_cat(sc) if sc:getCode() == "Jpan" then add_sc_cat(Hani) add_Hrkt() elseif sc:getCode() == "Kore" then add_sc_cat(Hang) add_sc_cat(Hani) end end end if lang:hasTranslit() then insert(ret, {name = "Category:Languages with automatic transliteration", sort = sortkey}) end local function insert_location_language_cat(location) local cat = "Mga wika ng " .. location --TLCHANGE "Languages of " .. location insert(ret, {name = "Category:" .. cat, sort = sortkey}) local auto_cat_args = scrape_category_for_auto_cat_args(cat) local location_parent = auto_cat_args and auto_cat_args.parent if location_parent then local split_parents = require(parse_utilities_module).split_on_comma(location_parent) for _, parent in ipairs(split_parents) do parent = parent:match("^(.-):.*$") or parent insert_location_language_cat(parent) end end end local saw_location = false for _, location in ipairs(locations) do if location ~= "UNKNOWN" then saw_location = true insert_location_language_cat(location) end end if extinct then insert(ret, {name = "Category:All extinct languages", sort = sortkey}) end if not saw_location and not (lang:hasType("reconstructed") or (fam and fam:getCode() == "art")) then -- Constructed and reconstructed languages don't need a location specified and often won't have one, -- so don't put them in this maintenance category. insert(ret, {name = "Category:Languages not sorted into a location category", sort = sortkey}) end return ret end local function get_children() local ret = {} -- FIXME: We should work on the children mechanism so it isn't necessary to manually specify these. -- TLCHANGE: for _, label in ipairs({"appendices", "entry maintenance", "lemmas", "names", "phrases", "rhymes", "symbols", "templates", "terms by etymology", "terms by usage"}) do for _, label in ipairs({"na apendise", "na entradang pinapanatili", "na lema", "na pangalan", "na parirala", "na tugma", "na simbolo", "na padron", "na salita ayon sa etimolohiya", "na salita ayon sa paggamit"}) do insert(ret, {name = label, is_label = true}) end insert(ret, {name = "na salitang hinango mula sa {{{langname}}}", is_label = true, lang = false}) --TLCHANGE "terms derived from {{{langname}}}" insert(ret, {name = "{{{langcode}}}:Lahat ng paksa", sort = "all topics"}) --TLCHANGE All topics insert(ret, {name = "Varayti ng {{{langname}}}"}) --TLCHANGE insert(ret, {name = "Requests concerning {{{langname}}}"}) insert(ret, {name = "Tugma:{{{langname}}}", description = "Lists of {{{langname}}} words by their rhymes."}) --TLCHANGE Rhymes insert(ret, {name = "User {{{langcode}}}", description = "Wiktionary users categorized by fluency levels in {{{langdisp}}}."}) return ret end -- Handle language categories of the form e.g. [[:Category:French language]] and -- [[:Category:British Sign Language]]. insert(raw_handlers, function(data) local category = data.category -- TLCHANGE: if not (category:match("[Ll]anguage$") or category:match("[Ll]ect$")) then if not (category:match("^[Ww]ika") or category:match("[Ll]ect$")) then return nil end local lang = m_languages.getByCanonicalName(category) if not lang then local langname = category:match("^Wikang (.*)") --TLCHANGE if langname then lang = m_languages.getByCanonicalName(langname) end if not lang then return nil end end local args = require("Module:parameters").process(data.args, { [1] = {list = true}, ["setwiki"] = true, ["setwikt"] = true, ["setsister"] = true, ["entryname"] = true, ["extinct"] = {type = "boolean"}, }) -- 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[1] == 0 and not data.called_from_inside then -- At least one location 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 location (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, topright, 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, topright, additional = get_description_topright_additional( lang, args[1], args.extinct, args.setwiki, args.setwikt, args.setsister, args.entryname ) end return { canonical_name = lang:getCategoryName(), description = description, lang = lang:getCode(), topright = topright, additional = additional, breadcrumb = lang:getCanonicalName(), parents = get_parents(lang, args[1], args.extinct), extra_children = get_children(lang), umbrella = false, can_be_empty = true, english_name = " language" --TLCHANGE }, true end) -- Handle categories such as [[:Category:Languages of Indonesia]]. insert(raw_handlers, function(data) local location = data.category:match("^Mga wika ng (.*)$") --TLCHANGE "^Languages of (.*)$" if location then local args = require("Module:parameters").process(data.args, { ["flagfile"] = true, ["commonscat"] = true, ["wp"] = true, ["basename"] = true, ["parent"] = true, ["locationcat"] = true, ["locationlink"] = true, }) local topright local basename = args.basename or location:gsub(", .*", "") if args.flagfile ~= "-" then local flagfile_arg = args.flagfile or ("Flag of %s.svg"):format(basename) local files = require(parse_utilities_module).split_on_comma(flagfile_arg) local topright_parts = {} for _, file in ipairs(files) do local flagfile = "File:" .. file local flagfile_page = new_title(flagfile) if flagfile_page and flagfile_page.file.exists then insert(topright_parts, ("[[%s|right|100px|border]]"):format(flagfile)) elseif args.flagfile then error(("Explicit flagfile '%s' doesn't exist"):format(flagfile)) end end topright = concat(topright_parts) end if args.wp then local wp = require("Module:yesno")(args.wp, "+") if wp == "+" or wp == true then wp = data.category end if wp then local wp_topright = ("{{wikipedia|%s}}"):format(wp) if topright then topright = topright .. wp_topright else topright = wp_topright end end end if args.commonscat then local commonscat = require("Module:yesno")(args.commonscat, "+") if commonscat == "+" or commonscat == true then commonscat = data.category end if commonscat then local commons_topright = ("{{commonscat|%s}}"):format(commonscat) if topright then topright = topright .. commons_topright else topright = commons_topright end end end local bare_location = location:match("^the (.*)$") or location local location_link = args.locationlink or link_location(location) local bare_basename = basename:match("^the (.*)$") or basename local parents = {} if args.parent then local explicit_parents = require(parse_utilities_module).split_on_comma(args.parent) for i, parent in ipairs(explicit_parents) do local actual_parent, sort_key = parent:match("^(.-):(.*)$") if actual_parent then parent = actual_parent sort_key = sort_key:gsub("%+", bare_location) else sort_key = " " .. bare_location end insert(parents, {name = "Mga wika ng " .. parent, sort = sort_key}) --TLCHANGE end else insert(parents, {name = "Wika ayon sa bansa", sort = {sort_base = bare_location, lang = "en"}}) --TLCHANGE end if args.locationcat then local explicit_location_cats = require(parse_utilities_module).split_on_comma(args.locationcat) for i, locationcat in ipairs(explicit_location_cats) do insert(parents, {name = "Category:" .. locationcat, sort = " Languages"}) end else local location_cat = ("Category:%s"):format(bare_location) local location_page = new_title(location_cat) if location_page and location_page.exists then insert(parents, {name = location_cat, sort = "Languages"}) end end local description = ("Mga kategorya sa mga wika ng %s (pati ang mga sublect)."):format(location_link) --TLCHANGE "Categories for languages of %s (including sublects)." return { topright = topright, description = description, parents = parents, breadcrumb = bare_basename, additional = "{{{umbrella_msg}}}", english_name = "Languages of " .. basename --TLCHANGE }, true end end) -- Handle categories such as [[:Category:English-based creole or pidgin languages]]. insert(raw_handlers, function(data) local langname = data.category:match("(.*)%-based creole or pidgin languages$") if langname then local lang = m_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 = {sort_base = "*" .. langname, lang = "en"}}}, breadcrumb = lang:getCanonicalName() .. "-based", } end end end) -- Handle categories such as [[:Category:English-based constructed languages]]. insert(raw_handlers, function(data) local langname = data.category:match("(.*)%-based constructed languages$") if langname then local lang = m_languages.getByCanonicalName(langname) if lang then return { lang = lang:getCode(), description = "Constructed languages which are based on " .. lang:makeCategoryLink() .. ".", parents = {{name = "Constructed languages", sort = {sort_base = "*" .. langname, lang = "en"}}}, breadcrumb = lang:getCanonicalName() .. "-based", } end end end) return {RAW_CATEGORIES = raw_categories, RAW_HANDLERS = raw_handlers} thmwjfz8hs54w16gbo301rsbndy2qn5 Module:category tree/rhymes 828 34567 176615 167648 2026-04-24T08:23:57Z Yivan000 4078 176615 Scribunto text/plain local labels = {} local raw_categories = {} local handlers = {} local raw_handlers = {} ----------------------------------------------------------------------------- -- -- -- LABELS -- -- -- ----------------------------------------------------------------------------- labels["na tugma"] = { --TLCHANGE description = "List of indexes of {{{langname}}} words by their rhymes.", umbrella_parents = "Pangkalahatan", --TLCHANGE "Fundamental" parents = {{name = "{{{langcat}}}", raw = true}}, english_name = "rhymes", --TLCHANGE } labels["refractory rhymes"] = { description = "Lists of {{{langname}}} words that don't rhyme with other words.", umbrella_parents = "Rhymes subcategories by language", parents = {"rhymes"}, } ----------------------------------------------------------------------------- -- -- -- RAW CATEGORIES -- -- -- ----------------------------------------------------------------------------- raw_categories["Rhymes subcategories by language"] = { description = "Umbrella categories covering topics related to rhymes.", additional = "{{{umbrella_meta_msg}}}", parents = { "Umbrella metacategories", {name = "rhymes", is_label = true, sort = " "}, }, } raw_categories["Rhymes"] = { description = "Umbrella categories covering rhymes by language.", additional = "{{{umbrella_meta_msg}}}", parents = { "Umbrella metacategories", {name = "rhymes", is_label = true, sort = " "}, }, } ----------------------------------------------------------------------------- -- -- -- HANDLERS -- -- -- ----------------------------------------------------------------------------- table.insert(handlers, function(data) local rhyme_beginning = data.label:match("^rhymes/(.-)%-$") if rhyme_beginning then return { description = ("{{{langname}}} rhyme indexes beginning with {{IPAchar|/%s/}}."):format(rhyme_beginning), additional = "The entries in this category are not dictionary entries, but rather indexes of {{{langname}}} terms that rhyme in specific ways.", parents = { {name = "rhymes", sort = rhyme_beginning}, }, breadcrumb = {name = ("{{IPAchar|/%s-/}}"):format(rhyme_beginning), nocap = true}, umbrella = false, } end end) ----------------------------------------------------------------------------- -- -- -- RAW HANDLERS -- -- -- ----------------------------------------------------------------------------- table.insert(raw_handlers, function(data) local function rhymeTopCategory(lang) return { lang = lang:getCode(), description = "Lists of " .. lang:makeCategoryLink() .. " words by their rhymes.", additional = "This is an umbrella category. It contains no dictionary entries, but rather possible rhymes as subcategories.", parents = { "{{{langcat}}}", {name = "Rhymes", sort = langname}, }, breadcrumb = "Rhymes", toctemplateprefix = "rhymetop" } end local function linkRhymeIfExists(lang, rhyme) -- {{change new|Though this could be ported to Wiktionary}} if mw.title.new('Rhymes:' .. lang:getCanonicalName() .. "/" .. rhyme).exists then return "'''[[Rhymes:" .. lang:getCanonicalName() .. "/" .. rhyme ..'|<span class="IPA">-' .. rhyme .. "</span>]]'''" end return '<span class="IPA">-' .. rhyme .. '</span>' end local function rhymeCategory(lang, rhyme) return { lang = lang:getCode(), description = "List of " .. lang:makeCategoryLink() .. ' words with the rhyme ' .. linkRhymeIfExists(lang, rhyme) .. '.', parents = { {name = "Rhymes:" .. lang:getCanonicalName(), sort = rhyme}, }, breadcrumb = '<span class="IPA">-' .. rhyme .. '</span>', displaytitle = 'Rhymes:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>' } end local function rhymeSyllableCountCategory(lang, rhyme, syllableCount) return { lang = lang:getCode(), description = "List of " .. syllableCount .. "-syllable " .. lang:makeCategoryLink() .. ' words with the rhyme ' .. linkRhymeIfExists(lang, rhyme) .. '.', parents = { {name = "Rhymes:" .. lang:getCanonicalName() .. "/" .. rhyme, sort = syllableCount}, }, breadcrumb = tostring(syllableCount) .. " syllables", displaytitle = 'Rhymes:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>/' .. tostring(syllableCount) .. " syllable" .. (syllableCount > 1 and "s" or "") } end local langname = data.category:match("^Tugma:([^/]+)") --TLCHANGE "^Rhymes:([^/]+)" if langname then local lang = require("Module:languages").getByCanonicalName(langname) if lang then local tokens = mw.text.split(data.category, "/") if #tokens > 1 then local rhyme = tokens[2] if #tokens == 3 then -- rhyme + syllable count category local syllables = nil --TLCHANGE --[[ if tokens[3] == "1 syllable" then syllables = 1 else ]] local syllablesregex = tokens[3]:match("(%d+) pantig") --TLCHANGE "(%d+) syllables" if syllablesregex then syllables = tonumber(syllablesregex) if syllables < 2 then syllables = nil end end --TLCHANGE end if syllables then return rhymeSyllableCountCategory(lang, rhyme, syllables) end elseif #tokens == 2 then -- rhyme category return rhymeCategory(lang, rhyme) end else -- rhyme language top category return rhymeTopCategory(lang) end end end end) return {LABELS = labels, RAW_CATEGORIES = raw_categories, HANDLERS = handlers, RAW_HANDLERS = raw_handlers} exex4gvgs8rkrpcvlkycrh4jvqv0cn5 176617 176615 2026-04-24T08:30:59Z Yivan000 4078 176617 Scribunto text/plain local labels = {} local raw_categories = {} local handlers = {} local raw_handlers = {} ----------------------------------------------------------------------------- -- -- -- LABELS -- -- -- ----------------------------------------------------------------------------- labels["na tugma"] = { --TLCHANGE description = "List of indexes of {{{langname}}} words by their rhymes.", umbrella_parents = "Pangkalahatan", --TLCHANGE "Fundamental" parents = {{name = "{{{langcat}}}", raw = true}}, english_name = "rhymes", --TLCHANGE } labels["refractory rhymes"] = { description = "Lists of {{{langname}}} words that don't rhyme with other words.", umbrella_parents = "Rhymes subcategories by language", parents = {"rhymes"}, } ----------------------------------------------------------------------------- -- -- -- RAW CATEGORIES -- -- -- ----------------------------------------------------------------------------- raw_categories["Rhymes subcategories by language"] = { description = "Umbrella categories covering topics related to rhymes.", additional = "{{{umbrella_meta_msg}}}", parents = { "Kataas-taasang kategorya", --TLCHANGE "Umbrella metacategories", {name = "na tugma", is_label = true, sort = " "}, --TLCHANGE "rhymes" }, } raw_categories["Tugma"] = { --TLCHANGE description = "Umbrella categories covering rhymes by language.", additional = "{{{umbrella_meta_msg}}}", parents = { "Kataas-taasang kategorya", --TLCHANGE "Umbrella metacategories", {name = "na tugma", is_label = true, sort = " "}, --TLCHANGE "rhymes" }, english_name = "Rhymes", --TLCHANGE } ----------------------------------------------------------------------------- -- -- -- HANDLERS -- -- -- ----------------------------------------------------------------------------- table.insert(handlers, function(data) local rhyme_beginning = data.label:match("^rhymes/(.-)%-$") if rhyme_beginning then return { description = ("{{{langname}}} rhyme indexes beginning with {{IPAchar|/%s/}}."):format(rhyme_beginning), additional = "The entries in this category are not dictionary entries, but rather indexes of {{{langname}}} terms that rhyme in specific ways.", parents = { {name = "na tugma", sort = rhyme_beginning}, --TLCHANGE "rhymes" }, breadcrumb = {name = ("{{IPAchar|/%s-/}}"):format(rhyme_beginning), nocap = true}, umbrella = false, } end end) ----------------------------------------------------------------------------- -- -- -- RAW HANDLERS -- -- -- ----------------------------------------------------------------------------- table.insert(raw_handlers, function(data) local function rhymeTopCategory(lang) return { lang = lang:getCode(), description = "Lists of " .. lang:makeCategoryLink() .. " words by their rhymes.", additional = "This is an umbrella category. It contains no dictionary entries, but rather possible rhymes as subcategories.", parents = { "{{{langcat}}}", {name = "Tugma", sort = langname}, --TLCHANGE "Rhymes" }, breadcrumb = "Tugma", --TLCHANGE "Rhymes", toctemplateprefix = "rhymetop" } end local function linkRhymeIfExists(lang, rhyme) -- {{change new|Though this could be ported to Wiktionary}} if mw.title.new('Rhymes:' .. lang:getCanonicalName() .. "/" .. rhyme).exists then return "'''[[Rhymes:" .. lang:getCanonicalName() .. "/" .. rhyme ..'|<span class="IPA">-' .. rhyme .. "</span>]]'''" end return '<span class="IPA">-' .. rhyme .. '</span>' end local function rhymeCategory(lang, rhyme) return { lang = lang:getCode(), description = "List of " .. lang:makeCategoryLink() .. ' words with the rhyme ' .. linkRhymeIfExists(lang, rhyme) .. '.', parents = { {name = "Tugma:" .. lang:getCanonicalName(), sort = rhyme}, --TLCHANGE "Rhymes:" }, breadcrumb = '<span class="IPA">-' .. rhyme .. '</span>', displaytitle = 'Rhymes:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>' } end local function rhymeSyllableCountCategory(lang, rhyme, syllableCount) return { lang = lang:getCode(), description = "List of " .. syllableCount .. "-syllable " .. lang:makeCategoryLink() .. ' words with the rhyme ' .. linkRhymeIfExists(lang, rhyme) .. '.', parents = { {name = "Tugma:" .. lang:getCanonicalName() .. "/" .. rhyme, sort = syllableCount}, --TLCHANGE "Rhymes:" }, breadcrumb = tostring(syllableCount) .. " syllables", displaytitle = 'Rhymes:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>/' .. tostring(syllableCount) .. " syllable" .. (syllableCount > 1 and "s" or "") } end local langname = data.category:match("^Tugma:([^/]+)") --TLCHANGE "^Rhymes:([^/]+)" if langname then local lang = require("Module:languages").getByCanonicalName(langname) if lang then local tokens = mw.text.split(data.category, "/") if #tokens > 1 then local rhyme = tokens[2] if #tokens == 3 then -- rhyme + syllable count category local syllables = nil --TLCHANGE --[[ if tokens[3] == "1 syllable" then syllables = 1 else ]] local syllablesregex = tokens[3]:match("(%d+) pantig") --TLCHANGE "(%d+) syllables" if syllablesregex then syllables = tonumber(syllablesregex) if syllables < 2 then syllables = nil end end --TLCHANGE end if syllables then return rhymeSyllableCountCategory(lang, rhyme, syllables) end elseif #tokens == 2 then -- rhyme category return rhymeCategory(lang, rhyme) end else -- rhyme language top category return rhymeTopCategory(lang) end end end end) return {LABELS = labels, RAW_CATEGORIES = raw_categories, HANDLERS = handlers, RAW_HANDLERS = raw_handlers} la4ghng3xyftt4qgsdf69i3zx8x10b3 176618 176617 2026-04-24T08:38:52Z Yivan000 4078 176618 Scribunto text/plain local labels = {} local raw_categories = {} local handlers = {} local raw_handlers = {} ----------------------------------------------------------------------------- -- -- -- LABELS -- -- -- ----------------------------------------------------------------------------- labels["na tugma"] = { --TLCHANGE description = "List of indexes of {{{langname}}} words by their rhymes.", umbrella_parents = "Pangkalahatan", --TLCHANGE "Fundamental" parents = {{name = "{{{langcat}}}", raw = true}}, english_name = "rhymes", --TLCHANGE } labels["refractory rhymes"] = { description = "Lists of {{{langname}}} words that don't rhyme with other words.", umbrella_parents = "Rhymes subcategories by language", parents = {"na tugma"}, --TLCHANGE {"rhymes"}, } ----------------------------------------------------------------------------- -- -- -- RAW CATEGORIES -- -- -- ----------------------------------------------------------------------------- raw_categories["Rhymes subcategories by language"] = { description = "Umbrella categories covering topics related to rhymes.", additional = "{{{umbrella_meta_msg}}}", parents = { "Kataas-taasang kategorya", --TLCHANGE "Umbrella metacategories", {name = "na tugma", is_label = true, sort = " "}, --TLCHANGE "rhymes" }, } raw_categories["Tugma"] = { --TLCHANGE description = "Umbrella categories covering rhymes by language.", additional = "{{{umbrella_meta_msg}}}", parents = { "Kataas-taasang kategorya", --TLCHANGE "Umbrella metacategories", {name = "na tugma", is_label = true, sort = " "}, --TLCHANGE "rhymes" }, english_name = "Rhymes", --TLCHANGE } ----------------------------------------------------------------------------- -- -- -- HANDLERS -- -- -- ----------------------------------------------------------------------------- table.insert(handlers, function(data) local rhyme_beginning = data.label:match("^rhymes/(.-)%-$") if rhyme_beginning then return { description = ("{{{langname}}} rhyme indexes beginning with {{IPAchar|/%s/}}."):format(rhyme_beginning), additional = "The entries in this category are not dictionary entries, but rather indexes of {{{langname}}} terms that rhyme in specific ways.", parents = { {name = "na tugma", sort = rhyme_beginning}, --TLCHANGE "rhymes" }, breadcrumb = {name = ("{{IPAchar|/%s-/}}"):format(rhyme_beginning), nocap = true}, umbrella = false, } end end) ----------------------------------------------------------------------------- -- -- -- RAW HANDLERS -- -- -- ----------------------------------------------------------------------------- table.insert(raw_handlers, function(data) local function rhymeTopCategory(lang) return { lang = lang:getCode(), description = "Lists of " .. lang:makeCategoryLink() .. " words by their rhymes.", additional = "This is an umbrella category. It contains no dictionary entries, but rather possible rhymes as subcategories.", parents = { "{{{langcat}}}", {name = "Tugma", sort = langname}, --TLCHANGE "Rhymes" }, breadcrumb = "Tugma", --TLCHANGE "Rhymes", toctemplateprefix = "rhymetop" } end local function linkRhymeIfExists(lang, rhyme) -- {{change new|Though this could be ported to Wiktionary}} if mw.title.new('Rhymes:' .. lang:getCanonicalName() .. "/" .. rhyme).exists then return "'''[[Rhymes:" .. lang:getCanonicalName() .. "/" .. rhyme ..'|<span class="IPA">-' .. rhyme .. "</span>]]'''" end return '<span class="IPA">-' .. rhyme .. '</span>' end local function rhymeCategory(lang, rhyme) return { lang = lang:getCode(), description = "List of " .. lang:makeCategoryLink() .. ' words with the rhyme ' .. linkRhymeIfExists(lang, rhyme) .. '.', parents = { {name = "Tugma:" .. lang:getCanonicalName(), sort = rhyme}, --TLCHANGE "Rhymes:" }, breadcrumb = '<span class="IPA">-' .. rhyme .. '</span>', displaytitle = 'Tugma:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>', --TLCHANGE 'Rhymes:' english_name = 'Rhymes:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>', --TLCHANGE } end local function rhymeSyllableCountCategory(lang, rhyme, syllableCount) return { lang = lang:getCode(), description = "List of " .. syllableCount .. "-syllable " .. lang:makeCategoryLink() .. ' words with the rhyme ' .. linkRhymeIfExists(lang, rhyme) .. '.', parents = { {name = "Tugma:" .. lang:getCanonicalName() .. "/" .. rhyme, sort = syllableCount}, --TLCHANGE "Rhymes:" }, breadcrumb = tostring(syllableCount) .. " syllables", --TLCHANGE displaytitle = 'Rhymes:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>/' .. tostring(syllableCount) .. " syllable" .. (syllableCount > 1 and "s" or "") displaytitle = 'Tugma:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>/' .. tostring(syllableCount) .. " pantig", english_name = 'Rhymes:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>/' .. tostring(syllableCount) .. " syllable" .. (syllableCount > 1 and "s" or "") --TLCHANGE } end local langname = data.category:match("^Tugma:([^/]+)") --TLCHANGE "^Rhymes:([^/]+)" if langname then local lang = require("Module:languages").getByCanonicalName(langname) if lang then local tokens = mw.text.split(data.category, "/") if #tokens > 1 then local rhyme = tokens[2] if #tokens == 3 then -- rhyme + syllable count category local syllables = nil --TLCHANGE --[[ if tokens[3] == "1 syllable" then syllables = 1 else ]] local syllablesregex = tokens[3]:match("(%d+) pantig") --TLCHANGE "(%d+) syllables" if syllablesregex then syllables = tonumber(syllablesregex) if syllables < 2 then syllables = nil end end --TLCHANGE end if syllables then return rhymeSyllableCountCategory(lang, rhyme, syllables) end elseif #tokens == 2 then -- rhyme category return rhymeCategory(lang, rhyme) end else -- rhyme language top category return rhymeTopCategory(lang) end end end end) return {LABELS = labels, RAW_CATEGORIES = raw_categories, HANDLERS = handlers, RAW_HANDLERS = raw_handlers} sa93xgaeakgp6t9z656oy5btodb3ylt 176622 176618 2026-04-24T08:59:01Z Yivan000 4078 176622 Scribunto text/plain local labels = {} local raw_categories = {} local handlers = {} local raw_handlers = {} ----------------------------------------------------------------------------- -- -- -- LABELS -- -- -- ----------------------------------------------------------------------------- labels["na tugma"] = { --TLCHANGE description = "List of indexes of {{{langname}}} words by their rhymes.", umbrella_parents = "Pangkalahatan", --TLCHANGE "Fundamental" parents = {{name = "{{{langcat}}}", raw = true}}, english_name = "rhymes", --TLCHANGE } labels["refractory rhymes"] = { description = "Lists of {{{langname}}} words that don't rhyme with other words.", umbrella_parents = "Rhymes subcategories by language", parents = {"na tugma"}, --TLCHANGE {"rhymes"}, } ----------------------------------------------------------------------------- -- -- -- RAW CATEGORIES -- -- -- ----------------------------------------------------------------------------- raw_categories["Rhymes subcategories by language"] = { description = "Umbrella categories covering topics related to rhymes.", additional = "{{{umbrella_meta_msg}}}", parents = { "Kataas-taasang kategorya", --TLCHANGE "Umbrella metacategories", {name = "na tugma", is_label = true, sort = " "}, --TLCHANGE "rhymes" }, } raw_categories["Tugma"] = { --TLCHANGE description = "Umbrella categories covering rhymes by language.", additional = "{{{umbrella_meta_msg}}}", parents = { "Kataas-taasang kategorya", --TLCHANGE "Umbrella metacategories", {name = "na tugma", is_label = true, sort = " "}, --TLCHANGE "rhymes" }, english_name = "Rhymes", --TLCHANGE } ----------------------------------------------------------------------------- -- -- -- HANDLERS -- -- -- ----------------------------------------------------------------------------- table.insert(handlers, function(data) local rhyme_beginning = data.label:match("^rhymes/(.-)%-$") if rhyme_beginning then return { description = ("{{{langname}}} rhyme indexes beginning with {{IPAchar|/%s/}}."):format(rhyme_beginning), additional = "The entries in this category are not dictionary entries, but rather indexes of {{{langname}}} terms that rhyme in specific ways.", parents = { {name = "na tugma", sort = rhyme_beginning}, --TLCHANGE "rhymes" }, breadcrumb = {name = ("{{IPAchar|/%s-/}}"):format(rhyme_beginning), nocap = true}, umbrella = false, } end end) ----------------------------------------------------------------------------- -- -- -- RAW HANDLERS -- -- -- ----------------------------------------------------------------------------- table.insert(raw_handlers, function(data) local function rhymeTopCategory(lang) return { lang = lang:getCode(), description = "Lists of " .. lang:makeCategoryLink() .. " words by their rhymes.", additional = "This is an umbrella category. It contains no dictionary entries, but rather possible rhymes as subcategories.", parents = { "{{{langcat}}}", {name = "Tugma", sort = langname}, --TLCHANGE "Rhymes" }, breadcrumb = "Tugma", --TLCHANGE "Rhymes", toctemplateprefix = "rhymetop", english_name = "Rhymes:" .. (lang:getData().english_name or lang:getCanonicalName()) --TLCHANGE } end local function linkRhymeIfExists(lang, rhyme) -- {{change new|Though this could be ported to Wiktionary}} if mw.title.new('Rhymes:' .. lang:getCanonicalName() .. "/" .. rhyme).exists then return "'''[[Rhymes:" .. lang:getCanonicalName() .. "/" .. rhyme ..'|<span class="IPA">-' .. rhyme .. "</span>]]'''" end return '<span class="IPA">-' .. rhyme .. '</span>' end local function rhymeCategory(lang, rhyme) return { lang = lang:getCode(), description = "List of " .. lang:makeCategoryLink() .. ' words with the rhyme ' .. linkRhymeIfExists(lang, rhyme) .. '.', parents = { {name = "Tugma:" .. lang:getCanonicalName(), sort = rhyme}, --TLCHANGE "Rhymes:" }, breadcrumb = '<span class="IPA">-' .. rhyme .. '</span>', displaytitle = 'Tugma:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>', --TLCHANGE 'Rhymes:' english_name = 'Rhymes:' .. (lang:getData().english_name or lang:getCanonicalName()) .. '/<span class="IPA">' .. rhyme .. '</span>', --TLCHANGE } end local function rhymeSyllableCountCategory(lang, rhyme, syllableCount) return { lang = lang:getCode(), description = "List of " .. syllableCount .. "-syllable " .. lang:makeCategoryLink() .. ' words with the rhyme ' .. linkRhymeIfExists(lang, rhyme) .. '.', parents = { {name = "Tugma:" .. lang:getCanonicalName() .. "/" .. rhyme, sort = syllableCount}, --TLCHANGE "Rhymes:" }, breadcrumb = tostring(syllableCount) .. " syllables", --TLCHANGE displaytitle = 'Rhymes:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>/' .. tostring(syllableCount) .. " syllable" .. (syllableCount > 1 and "s" or "") displaytitle = 'Tugma:' .. lang:getCanonicalName() .. '/<span class="IPA">' .. rhyme .. '</span>/' .. tostring(syllableCount) .. " pantig", english_name = 'Rhymes:' .. (lang:getData().english_name or lang:getCanonicalName()) .. '/<span class="IPA">' .. rhyme .. '</span>/' .. tostring(syllableCount) .. " syllable" .. (syllableCount > 1 and "s" or "") --TLCHANGE } end local langname = data.category:match("^Tugma:([^/]+)") --TLCHANGE "^Rhymes:([^/]+)" if langname then local lang = require("Module:languages").getByCanonicalName(langname) if lang then local tokens = mw.text.split(data.category, "/") if #tokens > 1 then local rhyme = tokens[2] if #tokens == 3 then -- rhyme + syllable count category local syllables = nil --TLCHANGE --[[ if tokens[3] == "1 syllable" then syllables = 1 else ]] local syllablesregex = tokens[3]:match("(%d+) pantig") --TLCHANGE "(%d+) syllables" if syllablesregex then syllables = tonumber(syllablesregex) if syllables < 2 then syllables = nil end end --TLCHANGE end if syllables then return rhymeSyllableCountCategory(lang, rhyme, syllables) end elseif #tokens == 2 then -- rhyme category return rhymeCategory(lang, rhyme) end else -- rhyme language top category return rhymeTopCategory(lang) end end end end) return {LABELS = labels, RAW_CATEGORIES = raw_categories, HANDLERS = handlers, RAW_HANDLERS = raw_handlers} e1z7cexpvy18biexvd4h42d5vw0uzaj Kategorya:Tugma:Tagalog/od 14 38061 176619 2026-04-24T08:51:19Z Yivan000 4078 Nilikha ang pahina na may '{{auto cat}}' 176619 wikitext text/x-wiki {{auto cat}} eomzlm5v4j7ond1phrju7cnue91g5qx Kategorya:Tugma:Tagalog 14 38062 176621 2026-04-24T08:56:15Z Yivan000 4078 Nilikha ang pahina na may '{{auto cat}}' 176621 wikitext text/x-wiki {{auto cat}} eomzlm5v4j7ond1phrju7cnue91g5qx Kategorya:Tugma 14 38063 176623 2026-04-24T08:59:37Z Yivan000 4078 Nilikha ang pahina na may '{{auto cat}}' 176623 wikitext text/x-wiki {{auto cat}} eomzlm5v4j7ond1phrju7cnue91g5qx Kategorya:Tugma:Tagalog/od/4 pantig 14 38064 176626 2026-04-24T09:04:26Z Yivan000 4078 Nilikha ang pahina na may '{{auto cat}}' 176626 wikitext text/x-wiki {{auto cat}} eomzlm5v4j7ond1phrju7cnue91g5qx