Module:Mod List

local p = {}

local function getMods(lang) local success, data = pcall(function       return mw.loadData(Module:Mods/list/..lang)    end) if not success then data = mw.loadData(Module:Mods/list) end return data.byName end

local function getName(mod, trans) local name = trans[mod] return name ~= nil and (trans[mod].localised or trans[mod].name) or mod end

function sort(cat, lang) local list = "" if lang == nil then list = mw:getCurrentFrame:callParserFunction{name = "#dpl:", args = {namespace = "", category = cat, nottitlematch = '%/%', allowcachedresults = "true"}} else list = mw:getCurrentFrame:callParserFunction{name = "#dpl:", args = {namespace = "", category = cat .. '/' .. lang, titlematch = '%/' .. lang, allowcachedresults = "true"}} end

if list:find("Warning: No results.", 51, true) == nil then local mods = {} for mod in list:gsub("", "¦"):sub(9,-11):gmatch("([^¦]+)") do			table.insert(mods, mod) end table.sort(mods) local list = "" if lang ~= nil then trans = getMods(lang) end for _, mod in ipairs(mods) do			if lang == nil then list = list .. mod .. " &bull; " else local m = mod:match("%[%[.*|(.*)%]%]") --Doesn't matter which one we take list = list .. "" .. getName(m:sub(1, -(#lang+2)), trans) .. " &bull; " end end return list:sub(1,-20) else return "Translate mods" end end

p.major = function(params) return sort("Mods", params.args.lang) end

p.minor = function(params) return sort("Minor Mods", params.args.lang) end

return p