Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Please sign up or log in to edit the wiki.

Module:Transit

From the Star Citizen Wiki, the fidelity™ encyclopedia
Revision as of 22:17, 17 October 2024 by Alistair3149 (talk | contribs) (Created page with "local Transit = {} local i18n = require( 'Module:i18n' ):new() local mArguments --- Wrapper function for Module:i18n.translate --- --- @param key string The translation key --- @return string|nil local function t( key ) return i18n:translate( key ) end --- Helper function for templates invoking the module --- --- @param frame table --- @return string function Transit.fromTemplate( frame ) mArguments = require( 'Module:Arguments' ) local args = mArguments.g...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Module documentation[view][edit][history][purge]
This documentation is transcluded from Module:Transit/doc. Changes can be proposed in the talk page.
Function list
L 12 — t
L 21 — Transit.fromTemplate

Used to show transit line in Star Citizen universe as a badge. The colors are defined in the data.json.


local Transit = {}

local i18n = require( 'Module:i18n' ):new()

local mArguments


--- Wrapper function for Module:i18n.translate
---
--- @param key string The translation key
--- @return string|nil
local function t( key )
	return i18n:translate( key )
end


--- Helper function for templates invoking the module
---
--- @param frame table
--- @return string
function Transit.fromTemplate( frame )
    mArguments = require( 'Module:Arguments' )
    local args = mArguments.getArgs( frame )
    local location = args[1]
    local name = args[2]

    if not location and not name then
        return mw.ustring.format( '<span class="error">%s</span>', t( 'message_error_no_text' ) )
    end

    return frame:expandTemplate{
        title = 'Badge',
        args = {
            name,
            bg = '#000',
            color = '#fff'
        }
    }
end


return Transit