Pergi ke kandungan

Modul:pendokumenan/functions/zh dial or syn

Daripada Wikikamus
return function(title, cats)
	local type_of_data, character = title.fullText:match("^Module:zh/data/dial%-(%l+)/(.+)$")
	if character then
		local what, where
		if type_of_data == "pron" then
			what = "sebutan"
			where = "dialek"
		elseif type_of_data == "syn" then
			what = "sinonim"
			where = "dialek dan varian"
		end
		
		if what then
			local link = require("Module:links").full_link{
				lang = require "Module:languages".getByCode("zh"),
				term = character:gsub("-[0-9]", ""),
			}
			local text = ("Modul ini mengandungi data berkenaan %s %s dalam %s bahasa Cina.")
				:format(what, link, where)
			if type_of_data == "syn" then
				text = text .. "\n" .. mw.getCurrentFrame():expandTemplate{ title = 'zh-dial', args = { character } }
			end
			return text
		end
	end
end