Module:zh-cat

Hello, you have come here looking for the meaning of the word Module:zh-cat. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:zh-cat, but we will also tell you about its etymology, its characteristics and you will know how to say Module:zh-cat in singular and plural. Everything you need to know about the word Module:zh-cat you have here. The definition of the word Module:zh-cat will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:zh-cat, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module does the job for Template:zh-cat.


local export = {}

local m_zh = require("Module:zh")
local m_data = require("Module:zh-cat/data")

function export.generateClsLink(text, doNotUsePagename)
	local trad = doNotUsePagename and text or mw.title.getCurrentTitle().text
	local simp = m_zh.ts(trad)
	return "Category:Chinese nouns classified by " .. (trad ~= simp and (trad .. "/" .. simp) or trad)
end
	
function export.categorize(frame)
	local args = type(frame) == "table" and frame:getParent().args or { frame }
	local PAGENAME = mw.loadData("Module:headword/data").pagename -- Accounts for unsupported titles and sets DEFAULTSORTKEY.
	local sortkey = (require("Module:languages").getByCode("zh"):makeSortKey(PAGENAME))
	local text = ""
	for _, cat in ipairs(args) do
		if mw.ustring.match(cat, "Classifier") then
			local parts = mw.text.split(cat, ":")
			text = text .. ", true) .. "|" .. sortkey .. "]]"
		
		elseif m_data.conventional_names then
			text = text .. " .. "|" .. sortkey .. "]]"
		else
			text = text .. "]"
		end
	end
	return (mw.title.getCurrentTitle().nsText == "" and text or "")
end

function export.clsCat(frame)
	local PAGENAME = mw.title.getCurrentTitle().text
	local part = mw.text.split(PAGENAME, " ")
	local character = part
	local sortkey = (require("Module:languages").getByCode("zh"):makeSortKey(character))
	return "Chinese nouns using " .. require("Module:zh/link").link(frame, nil, { character, tr = "-" }, character) ..
		" as their classifier.\n]"
end

return export