Module:TNTTools: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
No edit summary
No edit summary
Line 2: Line 2:


local TNT = require('Module:TNT')
local TNT = require('Module:TNT')
local SD = require('Module:SimpleDebug')


function TNTTabFull (TNTTab)
function p.TNTTabFull (TNTTab)
if (string.sub(TNTTab, 1, 5)) ~= 'I18n/' then
if (string.sub(TNTTab, 1, 5)) ~= 'I18n/' then
TNTTab = 'I18n/'..TNTTab
TNTTab = 'I18n/'..TNTTab
Line 14: Line 15:


function p.GetSTransWithParams (TNTTab, S, ...)
function p.GetSTransWithParams (TNTTab, S, ...)
return TNT.format (TNTTabFull(TNTTab), S, {...}) or ''
return TNT.format (p.TNTTabFull(TNTTab), S, {...}) or ''
end
end


function p.TabTransCS (TNTTab, S, CaseSensitive)
function p.TabTransCS (TNTTab, S, CaseSensitive)
CaseSensitive = ((CaseSensitive ~= nil) and (CaseSensitive == true)) or true
CaseSensitive = ((CaseSensitive ~= nil) and (CaseSensitive == true)) or true
local Wds = TNT.format (TNTTabFull(TNTTab), S)
local Wds = TNT.format (p.TNTTabFull(TNTTab), S)
if not CaseSensitive then
if not CaseSensitive then
Wds = string.lower (Wds)
Wds = string.lower (Wds)
Line 27: Line 28:


function p.TabTransMT (TNTTab, S, MaxTrans)
function p.TabTransMT (TNTTab, S, MaxTrans)
local FN = TNTTabFull(TNTTab)
local FN = p.TNTTabFull(TNTTab)
local tab = mw.text.split (TNT.format (FN, S), '|')
local tab = mw.text.split (TNT.format (FN, S), '|')
if #tab > MaxTrans then
if #tab > MaxTrans then