Module:Souls: Difference between revisions

Created a souls render function to help optimise other modules
 
m Added lang support for Souls link
Line 1: Line 1:
local p = {}
local p = {}
local Lang = require('Module:Lang')


-- Formats souls amount with an icon and styling
-- Formats souls amount with an icon and styling
Line 9: Line 11:


     local style = 'color:#98ffde; font-family:Retail Demo; text-wrap:nowrap; ' .. shadow
     local style = 'color:#98ffde; font-family:Retail Demo; text-wrap:nowrap; ' .. shadow
 
     local file     = '[[File:Souls iconColored.png|link=Souls|' .. size .. '|Souls]]'
local lang_code = Lang.get_lang_code()
local link = 'Souls'
if lang_code ~= 'en' then
link = 'Souls' .. lang_code
end
     local file = '[[File:Souls iconColored.png|link=' .. link .. '|' .. size .. '|Souls]]'
     local thin_space = amount and ' ' or ''
     local thin_space = amount and ' ' or ''
     local bold       = amount and '<b>' .. amount .. '</b>' or ''
     local bold = amount and '<b>' .. amount .. '</b>' or ''


     return '<span style="' .. style .. '">' .. file .. thin_space .. bold .. '</span>'
     return '<span style="' .. style .. '">' .. file .. thin_space .. bold .. '</span>'