Module:Translation

-- @author: UltimateSupreme local p = {} 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 = string.match(text, "%(") and ", " or " (" local t = text

if yn(arg) then 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

--TODO: Implement support 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] text = append(nil, args[2], text, "ja") 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("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 (English TV)", args["engtv meaning"], text) text = append(nil, args[4], text) --extra

return text..(string.match(text, "%(") and ")" or "") end return p

--