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

local function blendCategories(cat, otherCat, lang) if otherCat == nill then return lang == nil and cat or cat .. "/" .. lang else return lang == nil and cat .. "|" .. otherCat or cat .. "/" .. lang .. "|" .. otherCat .. "/" .. lang end end

function sort(cat, cat2, lang) local list = "" if lang == nil then lang = require(Module:Utility_functions).pageSuffix:sub(2) if lang == "en" then list = mw:getCurrentFrame:callParserFunction{name = "#dpl:", args = {namespace = "", category = blendCategories(cat, cat2, nil), nottitlematch = '%/%', allowcachedresults = "true"}} else list = mw:getCurrentFrame:callParserFunction{name = "#dpl:", args = {namespace = "", category = blendCategories(cat, cat2, lang), titlematch = '%/' .. lang, allowcachedresults = "true"}} end else list = mw:getCurrentFrame:callParserFunction{name = "#dpl:", args = {namespace = "", category = blendCategories(cat, cat2, 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 if lang == "en" then list = list .. "" .. getName(m, trans) .. " &bull; " else list = list .. "" .. getName(m:sub(1, -(#lang+2)), trans) .. " &bull; " end end end return list:sub(1,-20) else return "Translate mods" end end

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

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

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

return p