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

Module:TranslationData

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.

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

local p = {}

p.messages = {
    en = { header = "Machine Translation", body = "This page began as a machine translation from English. Please help us make it more natural!", edit = "Edit this translation", source = "Original English version" },
    de = { header = "Maschinelle Übersetzung", body = "Diese Seite wurde ursprünglich maschinell aus dem Englischen übersetzt. Bitte hilf uns, sie natürlicher zu gestalten!", edit = "Übersetzung bearbeiten", source = "Englische Originalversion" },
    fr = { header = "Traduction Automatique", body = "Cette page est issue d'une traduction automatique de l'anglais. Merci de nous aider à la rendre plus naturelle !", edit = "Modifier la traduction", source = "Version anglaise originale" },
    zh = { header = "机器翻译", body = "本页面最初由英文机器翻译而成。请帮助我们完善语言,使其更加自然!", edit = "编辑翻译", source = "英文原文" },
    es = { header = "Traducción Automática", body = "Esta página comenzó como una traducción automática del inglés. ¡Ayúdenos a hacerla más natural!", edit = "Editar traducción", source = "Versión original en inglés" }
}

function p.renderNotice(frame)
    local title = mw.title.getCurrentTitle()
    
    -- If it's a subpage (e.g., Namespace:Page/de), basePageTitle keeps the Namespace:Page part
    local basePage = title.basePageTitle.fullText
    local lang = title.subpageText 
    
    -- Fallback for non-subpages
    if not title.isSubpage then lang = "en" end
    local msg = p.messages[lang] or p.messages["en"]

    -- Generate the Direct Edit URL
    local editUrl = title:fullUrl('action=edit')

    -- Construct the HTML string
    local output = msg.body .. "<br />"
    output = output .. "'''[" .. editUrl .. " " .. msg.edit .. "]''' &bull; "
    output = output .. "'''[[" .. basePage .. "|" .. msg.source .. "]]'''"
    
    return output
end

function p.getHeader(frame)
    local title = mw.title.getCurrentTitle()
    local lang = title.isSubpage and title.subpageText or "en"
    local msg = p.messages[lang] or p.messages["en"]
    return msg.header
end

return p