Module:TNTTools: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
m
6 revisions imported
No edit summary
m (6 revisions imported)
 
(3 intermediate revisions by 2 users not shown)
Line 2:
 
local TNT = require('Module:TNT')
--local SD = require('Module:SimpleDebug')
 
function p.TNTTabFull (TNTTab)
if (string.sub(TNTTab, 1, 5)) ~= 'I18n/' then
TNTTab = 'I18n/'..TNTTab
Line 13 ⟶ 14:
end --TNTTabFull
 
function p.GetSTransWithParamsTNTTabCommons (TNTTab, S, ...)
return TNT'Commons:Data:'..p.format (TNTTabFull(TNTTab), S, {...}) or ''
end
 
function p.LnkTNTTab (TNTTab)
return '[['..p.TNTTabCommons(TNTTab)..']]'
end
 
function I18nStr (TNTTab, S, IsMsg, params)
TNTTab = p.TNTTabFull (TNTTab)
local SEnd = TNT.format(TNTTab, S, unpack(params)) or ''
if SEnd == '' then
SEnd = TNT.formatInLanguage('en',TNTTab, S, unpack(params))
if IsMsg then
local icon = '[[File:Arbcom ru editing.svg|12px|Not found "'..S..'" in current language. Click here for to edit it.|link='..p.TNTTabCommons(TNTTab)..']]'
SEnd = SEnd..icon
end
end
return SEnd
end --I18nStr
 
function p.GetMsgP (TNTTab, S, ...)
return I18nStr (TNTTab, S, true, {...})
end
 
function p.GetStrP (TNTTab, S, ...)
return I18nStr (TNTTab, S, false, {...})
end
 
function p.TabTransCS (TNTTab, S, CaseSensitive)
CaseSensitive = ((CaseSensitive ~= nil) and (CaseSensitive == true)) or true
local Wds = TNT.format (p.TNTTabFull(TNTTab), S)
if not CaseSensitive then
Wds = string.lower (Wds)
Line 27 ⟶ 53:
 
function p.TabTransMT (TNTTab, S, MaxTrans)
local FN = p.TNTTabFull(TNTTab)
local tab = mw.text.split (TNT.format (FN, S), '|')
if #tab > MaxTrans then
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu