Module:Translation

-- @author: UltimateSupreme -- @source: http://naruto.wikia.com/wiki/Module:Translation local p, flag = {}, false local yn = require( 'Module:Yesno' ) local err = require( 'Module:Error' )

-- Check if the arg exists -- If yes, append it to the text local function append(label, arg, text, lang)

local c = flag and "&#44; " or " ("   local t = text

if yn(arg) then flag = true if lang then arg = tostring(               mw.html.create("span")                :attr("lang", lang)                :wikitext(arg)            ) end

if label then t = t..c..""..label..": "..arg else t = t..c..arg end end

return t end

function p.rubify(base, ann) return " "..base..", "..ann.." " end

function p.translate(frame) local args = frame:getParent.args

if not yn(args[1]) then return err("Provide an official name") end

local text = args[1] if args.furigana then args[2] = p.rubify(args[2], args.furigana) end text = append(nil, args[2], text)

if yn(args[3]) then text = append(nil, ""..args[3].."", text) end

text = append("English", args.eng, text) text = append("Latin", args.latin, text, "la") text = append("FUNimation", args.funi, text) text = append("Viz", args.viz, text) text = append("Kodansha Comics USA", args.kc, text) text = append("English TV", args.engtv, text) text = append("UK DVD", args.ukdvd, text) text = append("Fansub", args.fansub, text) text = append("Literally meaning", args["lit meaning"], text) text = append("Meaning (Viz)", args["viz meaning"], text) text = append("Meaning (Kodansha)", args["kc meaning"], text) text = append("Meaning (English TV)", args["engtv meaning"], text) text = append(nil, args[4], text) --extra

return text..(flag and ")" or "") end return p

--