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 lang = require(Module:Utility_functions).pageSuffix:sub(2) if lang == "en" 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 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 or cat ~= "Mods" then --This only works for Mods right not, but whatever. 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" end end

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

p.modpacks = function(params) return sort("Modpacks", nil, params.args.lang) end

p.officialtechnicmodpacks = function(params) return sort("Official Technic modpacks", nil, params.args.lang) end

p.technicmodpacks = function(params) return sort("Technic modpacks", nil, params.args.lang) end

p.atlaunchermodpacks = function(params) return sort("ATLauncher modpacks", nil, params.args.lang) end

return p