Module:TableTranslation
Appearance
local p = {}
function p.render(frame)
local args = frame.args
local lang1 = args[1]
local lang2 = args[2]
if not lang1 or not lang2 then
return "Error: Two language names must be provided."
end
-- Start building the wikitext for the table
local output = {}
table.insert(output, '{| class="wikitable"')
table.insert(output, string.format("! %s !! %s", lang1, lang2))
-- Each pair: args[3] is text, args[4] is translation, etc.
for i = 3, #args, 2 do
local text = args[i]
local translation = args[i + 1]
if text and translation then
table.insert(output, string.format("|-\n| %s || %s", text, translation))
end
end
table.insert(output, "|}")
return table.concat(output, "\n")
end
return p