5,326 Pages

-- Contains functions for translating English terms into Russian for interwiki links
-- <pre>
 
local p = {}
 
-- Dependencies
local lib = require('Module:Feature')
 
-- Returns Russian name of existing champion
function p.getChampionNameRU(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local champion      = args['champion'] or args[1]
    local championTable = mw.loadData('Module:Translator/ChampionNamesRU')
 
    return championTable[champion]
end
 
-- Creates interwiki link for champion subpage, on which this function is invoked
function p.getInterwikiLinkRU(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
 
    local subpageTable = {
        ["Abilities"]   = "Умения",
        ["Strategy"]    = "Умения",
        ["Background"]  = "Биография",
        ["Quotes"]      = "Фразы",
        ["History"]     = "История изменений",
        ["Development"] = "Разработка",
        ["Skins"]       = "Образы",
        ["Trivia"]      = "Прочее",
        ["LOR"]         = "LoR",
        ["TFT"]         = "TFT"
    }
    local thisTitle  = mw.title.getCurrentTitle()
    local ruChampion = p.getChampionNameRU{thisTitle.rootText}
    local ruSubpage  = subpageTable[mw.title.getCurrentTitle().subpageText]
 
    if ruChampion == nil then
        return ""
    elseif ruSubpage == nil then
        return frame:preprocess('[[ru:' .. ruChampion .. ']]')
    else
        return frame:preprocess('[[ru:' .. ruChampion .. "/" .. ruSubpage .. ']]')
    end
end
 
return p
-- </pre>
-- [[Category:Lua]]
Community content is available under CC-BY-SA unless otherwise noted.