Module:languages: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 391: Line 391:


function Language:transliterate(text, sc, module_override)
function Language:transliterate(text, sc, module_override)
if not ((module_override or self._rawData.translit_module) and text) then
local m = self._rawData.translit_module
if not ((module_override or m) and text) then
return nil
return nil
end
end
return require("Module:" .. (module_override or self._rawData.translit_module)).tr(text, self:getCode(), sc and sc:getCode() or nil)
return require((mw.ustring.match(m, "$w:") and "w:" or "") .. "Module:"
.. (module_override or (mw.ustring.match(m, "$w:") and mw.ustring.sub(m, 3) or m))).tr(text, self:getCode(), sc and sc:getCode() or nil)
end
end