Module:Maintainers

-- Component information table -- local i18n = { -- Internationalization table. All human-readable strings (but not Phabricator	-- tags or IRC channel names) should be here and should be overridden with -- translatable i18n-* parameters in the template. ["steward-anti-harassment"] = "Anti-Harassment Tools", ["steward-core-platform-team"] = "Core Platform Team", ["steward-performance-team"] = "Performance Team", ["maintainedby"] = "Maintained by $1.", ["livechat"] = "Live chat (IRC): $1", ["issuetracker"] = "Issue tracker: [$1 Phabricator] ([$2 Report an issue])", }

local stewards = { -- Format: --	-- [key]: Lowercase steward ID. (used from 'maintainers' table below) -- namekey: Key in the above i18n table that contains the name of steward, linked. (optional) -- irc: Name of Freenode IRC channel, without leading hash. (optional) --	["anti-harassment"] = { namekey = "steward-anti-harassment", },	["core-platform-team"] = { namekey = "steward-core-platform-team", irc = "mediawiki-core", },	["performance-team"] = { namekey = "steward-performance-team", irc = "wikimedia-perf", } } local maintainers = { -- Format: --	-- [key]: Lowercase component ID. (used from Template:Component) -- steward: Key to 'stewards' lookup table above. (optional) -- phab: Name of Phabricator tag. (optional) --

-- MediaWiki core components ["mediawiki-api"] = { steward = "core-platform-team", phab = "mediawiki-api", },	["mediawiki-auth"] = { steward = "core-platform-team", phab = "mediawiki-auth", },	["mediawiki-blocks"] = { steward = "anti-harassment", phab = "mediawiki-blocks", },	["mediawiki-cache"] = { steward = "core-platform-team", phab = "mediawiki-cache", },	["mediawiki-comment-store"] = { steward = "core-platform-team", phab = "mediawiki-comment-store", },	["mediawiki-configuration"] = { steward = "core-platform-team", phab = "mediawiki-configuration", },	["mediawiki-contenthandler"] = { steward = "core-platform-team", phab = "mediawiki-contenthandler", },	["mediawiki-jobqueue"] = { steward = "core-platform-team", phab = "mediawiki-jobqueue", },	["mediawiki-redirects"] = { phab = "mediawiki-redirects", },	["mediawiki-interface"] = { phab = "mediawiki-interface", },

-- MediaWiki extensions and skins ["navigationtiming"] = { steward = "performance-team", phab = "MediaWiki-extensions-NavigationTiming", },

-- Libraries ["cdb"] = { steward = "performance-team", phab = "wikimedia-cdb", },	["relpath"] = { steward = "performance-team", phab = "mediawiki-resourceloader", },	["resourceloader"] = { steward = "performance-team", phab = "mediawiki-resourceloader", },	["runningstat"] = { steward = "performance-team", phab = "runningstat", },	["scopedcallback"] = { steward = "performance-team", phab = "scopedcallback", },	["waitconditionloop"] = { steward = "performance-team", phab = "waitconditionloop", },	["wrappedstring"] = { steward = "performance-team", phab = "WrappedString", }, }

-- Set translated strings from parameters in the above i18n table. local function setI18n( args ) for n, _ in pairs( i18n ) do if args[ "i18n-" .. n ] then i18n[ n ] = args[ "i18n-" .. n ] end end end

-- Get a translated string from the above i18n table, with optional parameter substitution. local function msg( name, ... ) if i18n[ name ] then return mw.message.newRawMessage( i18n[ name ], ... ):plain else return nil end end

-- Lua methods to access the above information.

local function get_steward_link( key ) local steward = maintainers[ key ] and maintainers[ key ].steward or "?" local link = stewards[ steward ] and i18n[ stewards[ steward ].namekey ] or "?" return link end

local function get_irc_channel( key ) local steward = maintainers[ key ] and maintainers[ key ].steward or "?" return stewards[ steward ] and stewards[ steward ].irc or nil end

-- Exported lua module

local p = {} function p.link_stewardship( frame ) local key = string.lower( frame.args[1] ) return get_steward_link( key ) end function p.link_issues( frame ) local key = string.lower( frame.args[1] ) local phab = maintainers[ key ] and maintainers[ key ].phab if phab then return "[https://phabricator.wikimedia.org/tag/" .. mw.uri.encode( phab ) .. "/ Phabricator]" end return "" end function p.info( frame ) setI18n( frame.args ) local key = mw.text.trim( string.lower( frame.args[1] ) ) local line = "* " .. msg( "maintainedby", get_steward_link( key ) ) local irc_channel = get_irc_channel( key ) if irc_channel then -- Invoke line = line .. "\n* " .. msg( "livechat", frame:expandTemplate{ title = 'irc', args = { irc_channel } } ) end local phab = maintainers[ key ] and maintainers[ key ].phab if phab then line = line .. "\n* " .. msg( "issuetracker",			"https://phabricator.wikimedia.org/tag/" .. mw.uri.encode( phab ) .. "/",			"https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?projects=" .. mw.uri.encode( phab )		) end return line end return p