Difference between revisions of "Module:TNTTools/doc"

From blackwiki
Jump to navigation Jump to search
test>Jmarchn
test>Jmarchn
m (Update)
Line 11: Line 11:
 
**{{tl|TNTTools/Tests/WordIdx}}
 
**{{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]].
+
With [[Module:SimpleArgs]] allows '''get parameter values''' (passed from the ''frame'') with '''several keys for the same parameter'''.
  
For example, with a parameter that has two or more meanings (or in English and localized languge):
+
For example, with a parameter that has two or more meanings (or in English and localized language):
 
<syntaxhighlight lang="Lua">
 
<syntaxhighlight lang="Lua">
 
local p = {}
 
local p = {}

Revision as of 12:53, 25 October 2019

Contains functions linked to Module:TNT, which at the same time make calls to multilingual tables, located in Commons.

It 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.
  • You can find examples of direct use from templates in:

With Module:SimpleArgs allows get parameter values (passed from the frame) with several keys for the same parameter.

For example, with a parameter that has two or more meanings (or in English and localized language):

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