VOOZH about

URL: https://minecraft.wiki/w/Module:Language_template_transcluder

⇱ Module:Language template transcluder – Minecraft Wiki


Module:Language template transcluder

From Minecraft Wiki
Jump to navigation Jump to search
Documentation[create] [purge]
This module has no documentation. If you know how to use this module, please create it.
localp={}
functionp.passParams(frame)
localargs=frame:getParent().args-- Get parameters from template "lt"
localparams={}
localt=(args["t"]:gsub("^%l",string.upper))-- Get the value of "t"
ift==""then
return"Error: Missing template name"
end
-- Get FULLPAGENAME and extract the translation projects name (second) part
localtitle=mw.title.getCurrentTitle().fullText
localparts=mw.text.split(title,"/",true)-- Split the title by "/"
if#parts<2then
return"Error: The page is not in any translation projects"
end
-- Determine which namespace the module is in
localpt
ifmw.title.getCurrentTitle().nsText=='Template'then
pt=parts[1]:gsub("^Template:","")-- Get the first part
else
pt=parts[2]-- Get the second part
end
-- Construct the correct template name
localtemplateName="Template:"..pt.."/"..t
-- Filter parameters, excluding "t"
forkey,valueinpairs(args)do
ifvalue~=""andkey~="t"then
params[key]=value
end
end
-- Expand and return the actual template content
localsuccess,result=pcall(frame.expandTemplate,frame,{title=templateName,args=params})
ifsuccessthen
returnresult
end
return'[['..templateName..']]'
end
returnp
Retrieved from "https://minecraft.wiki/w/Module:Language_template_transcluder?oldid=3223789"

Navigation menu