Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Translation

From the only original and legitimate Battlestar Wiki: the free-as-in-beer, non-corporate, open-content encyclopedia, analytical reference, and episode guide on all things Battlestar Galactica. Accept neither subpar substitutes nor subpar clones.
Revision as of 15:07, 6 March 2026 by Joe Beaudoin Jr. (talk | contribs) (Created page with "local p = {} function p.listLanguages(frame) local parent = frame:getParent() local title = mw.title.getCurrentTitle() local basePage = title.fullText -- Define your language mapping here local langNames = { de = "Deutsch", fr = "Français", zh = "中文", es = "Español", it = "Italiano", ru = "Русский", ja = "日本語" } local links = {} -- Loop through the d...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Translation/doc

local p = {}

function p.listLanguages(frame)
    local parent = frame:getParent()
    local title = mw.title.getCurrentTitle()
    local basePage = title.fullText
    
    -- Define your language mapping here
    local langNames = {
        de = "Deutsch",
        fr = "Français",
        zh = "中文",
        es = "Español",
        it = "Italiano",
        ru = "Русский",
        ja = "日本語"
    }
    
    local links = {}
    
    -- Loop through the defined languages and check if subpages exist
    for code, name in pairs(langNames) do
        local subpage = mw.title.new(basePage .. '/' .. code)
        if subpage and subpage.exists then
            table.insert(links, "[[" .. basePage .. "/" .. code .. "|" .. name .. "]]")
        end
    end
    
    if #links > 0 then
        return table.concat(links, " • ")
    else
        return "No translations available yet."
    end
end

return p