Module:Translation

-- @author: UltimateSupreme 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, "ja")

if yn(args[3]) and args[3] ~= args[1] and args[3] ~= mw.title.getCurrentTitle.text 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..(flag and ")" or "") end return p

--