Module:TNTTools/doc: Difference between revisions
Content added Content deleted
No edit summary |
m (15 revisions imported: Borrowing a module from Wikipedia.) |
||
(11 intermediate revisions by 4 users not shown) | |||
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. |
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: |
|||
* '''Question functions''': with boolean or numerical indexed return. To be called from other modules or from templates. With: |
* '''Question functions''': with boolean or numerical indexed return. To be called from other modules or from templates. With: |
||
** Case sensitive option. |
** Case sensitive option. |
||
** 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. |
||
* You can find '''examples''' of direct use from templates in: |
|||
**{{tl|TNTTools/Tests/GetStr}} |
|||
**{{tl|TNTTools/Tests/WordFound}} |
|||
**{{tl|TNTTools/Tests/WordIdx}} |
|||
Allows '''verification of parameter names''' passed from the ''frame'' when two (or more) denominations are supported by the same parameter. With the help of the [[Module:SimpleArgs]]. |
|||
For example, with a parameter that has two or more meanings (or in English and localized languge): |
|||
<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> |
|||
<includeonly> |
|||
[[Category:Modules for general use]] |
|||
</includeonly> |
Latest revision as of 14:22, 1 January 2022
This module is rated as ready for general use. It has reached a mature form and is thought to be bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
Contains functions linked to Module:TNT, which at the same time make calls to multilingual tables, located in Commons, for the creation of modules and multilingual templates.
TNTTools has:
- Question functions: with boolean or numerical indexed return. To be called from other modules or from templates. With:
- Case sensitive option.
- 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.