Difference between revisions of "Module:Template translation"
Module:Template translation (view source)
Revision as of 15:21, 19 January 2014
, 15:21, 19 January 2014no edit summary
>Verdy p m (frame:expandTemplate() still incorrectly assumes a default "Template:" namespace, even when passing a full title object and not a page name) |
>Verdy p m |
||
Line 21: | Line 21: | ||
]] | ]] | ||
function this.getLanguageSubpage() | function this.getLanguageSubpage() | ||
--[[This code does not work ib all namespaces where the Translate tool works. | |||
return this.checkLanguage(subpage, | -- It works in the main namespace on Meta because it allows subpages there | ||
-- 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 | end | ||