Module:TNTTools/doc: Difference between revisions
Content added Content deleted
mNo edit summary |
(Template:Module rating, remove references to deleted modules) |
||
Line 1: | Line 1: | ||
{{module rating|release}} |
|||
Contains functions linked to [[Module:TNT]], which at the same time make calls to multilingual tables, located in Commons, for the creation of [[mw:Multilingual_Templates_and_Modules|modules and multilingual templates]]. |
Contains functions linked to [[Module:TNT]], which at the same time make calls to multilingual tables, located in Commons, for the creation of [[mw:Multilingual_Templates_and_Modules|modules and multilingual templates]]. |
||
TNTTools has: |
TNTTools has: |
||
Line 6: | Line 7: | ||
** Possibility of '''more than one translated text value''' (where each value is separated by "|"). |
** Possibility of '''more than one translated text value''' (where each value is separated by "|"). |
||
* To put aside write, adding "I18n/" as a prefix and ".tab" extension as a suffix for the table names. |
* To put aside write, adding "I18n/" as a prefix and ".tab" extension as a suffix for the table names. |
||
An example is [[Module:YesnoTNT]] and {{tl|YesnoTNT}}. |
|||
For example, with a parameter that has two or more meanings (or in English and localized language): |
|||
<syntaxhighlight lang="Lua"> |
|||
local p = {} |
|||
local SA = require "Module:SimpleArgs" |
|||
local TNTT = require "Module:TNTTools" |
|||
local function I18nStrTab (S) |
|||
return TNTT.TabTransMT ('TableName',S) |
|||
--in this case 'P_Action' from 'II18n/TableName.tab' contains 'action' and 'function' like this 'action|function' |
|||
end |
|||
function p.main (frame) |
|||
args = SA.GetArgs (frame) |
|||
local action = SA.SArgs.GetStrFromArgs (args, I18nStrTab('P_Action')) |
|||
--title will take the value from the parameter |action= or |function= |
|||
... |
|||
end |
|||
return p |
|||
</syntaxhighlight> |
|||
'''[[Module:ArgsTNT]]''', designed to create multilingual '''templates''', allows get parameter values (passed from the ''frame'') with several keys for the same parameter. |
|||
<includeonly> |
|||
[[Category:Modules for general use]] |
|||
</includeonly> |