Module:Caller title/sandbox
Jump to navigation
Jump to search
CodeDiscussionEditHistoryLinksLink count Subpages:DocumentationTestsResultsSandboxLive code All modules
Lua
Documentation for this module may be created at Module:Caller title/sandbox/doc
Code
local p = {}
function p.title(frame)
return frame:getParent():getTitle()
end
function p.lang(frame)
local base = frame.args.base
local title = mw.title.new(p.title(frame))
if base == title.fullText then
-- we’re on the base page of the translation (directly, it’s not translated from somewhere),
-- so we have no subpage language code, but we use pageLang
return title.pageLang.code
else
-- we're on a language subpage
-- so we return the subpage text
return title.subpageText
end
end
return p