Module:Languages

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Revision as of 18:11, 23 December 2024 by Paisley Park (talk | contribs)
Jump to navigation Jump to search

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

local p = {}

local function has_page(tab, lang)
    for _, value in ipairs(tab) do
        if value == lang then
            return true
        end
    end
    return false
end

function p.generate(frame)
    local languagesData = mw.loadData('Module:Languages/data')
    local title = frame:getParent():getTitle() or ''
    local links = {}
    for _, lang in ipairs(languagesData) do
        table.insert(links, string.format('{{Languages/Lang|%s}}', lang))
    end
    return table.concat(links, '')
end

function p.main(frame)
    local languagesData = mw.loadData('Module:Languages/data')
    if has_page(languagesData, 'fr') then
        return "Yes"
    else
        return "No"
    end
end

return p