Module:Template translation: Difference between revisions

m
no edit summary
m (frame:expandTemplate() still incorrectly assumes a default "Template:" namespace, even when passing a full title object and not a page name)
mNo edit summary
Line 21:
]]
function this.getLanguageSubpage()
--[[This code does not work ib all namespaces where the Translate tool works.
local subpage = mw.title.getCurrentTitle().subpageText
-- It works in the main namespace on Meta because it allows subpages there
return this.checkLanguage(subpage, '')
-- It would not work in the main namespace of English Wikipedia (but the
-- articles are monolignual on that wiki).
-- On Meta-Wiki the main space uses subpages and its pages are translated.
-- The Translate tool allows translatng pages in all namespaces, even if
-- the namespace officially does not have subpages.
-- On Meta-Wiki the Category namespace still does not have subpages enabled,
-- even if they would be very useful for categorizing templates, that DO have
-- subpages (for documentatio and tstboxes pages). This is a misconfiguration
-- bug of Meta-Wiki. The work-around is to split the full title and then
-- get the last titlepart.
local subpage = mw.title.getCurrentTitle().subpageText
--]]
local titleparts = mw.text.split(mw.title.getCurrentTitle().fullText, '/')
local subpage = titleparts[#titleparts]
return this.checkLanguage(subpage, ''mw.language.getContentLanguage():getCode())
end
 
Anonymous user