Module:Mandarin frequency list

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

Used to quickly generate tables of words in subpages of Appendix:Mandarin Frequency lists.


local export = {}

local unpack = unpack or table.unpack -- Lua 5.2 compatibility
	
local header = [[
{| class="wikitable"
|-
! Traditional !! Simplified !! Pinyin !! Meaning
]]
local footer = ]

local function link(word, lang_code, lang_name, script)
	return '<span class="' .. script .. '" lang="' .. lang_code .. '">[['
		.. word .. '#' .. lang_name .. '|' .. word .. ']]</span>'
end

function export.list(frame)
	local args = require "Module:table".shallowCopy(frame.args)
	if #args % 4 ~= 0 then
		error(("The number of arguments should be a multiple of four, but is %d")
			:format(#args))
	end
	
	local Array = require "Module:array"
	local output = Array()
	output:insert(header)
	for i = 1, #args, 4 do
		local traditional, simplified, pinyin, gloss = unpack(args, i, i + 3)
		output:insert(("|-\n| %s || %s || %s || %s\n"):format(
			link(traditional, "zh-Hant", "Chinese", "Hant"),
			link(simplified, "zh-Hans", "Chinese", "Hans"),
			link(pinyin, "cmn-Latn-pinyin", "Mandarin", "Latn"),
			gloss))
	end
	output:insert(footer)
	return output:concat()
end

return export