Module:TNT: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
resetting to the main mediawiki.org version, allows auto-syncing
(Module has been nominated for deletion) |
(resetting to the main mediawiki.org version, allows auto-syncing) |
||
Line 1:
-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!)
-- This module allows any template or module to be copy/pasted between
-- wikis without any translation changes. All translation text is stored
-- in the global Data:*.tab pages on Commons, and used everywhere.
--
-- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules
--
-- ATTENTION:
Line 5 ⟶ 12:
-- Please do not modify it anywhere else, as it may get copied and override your changes.
-- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT
▲--
-- DESCRIPTION:▼
--
▲-- DESCRIPTION:
-- The "msg" function uses a Commons dataset to translate a message
-- with a given key (e.g. source-table), plus optional arguments
-- to the wiki markup in the current content language.
-- Use lang=xx to set language. Example:
--
--
-- | I18n/Template:Graphs.tab
-- | source-table <!-- uses a translation message with id = "source-table" -->
-- | param1 }} <!-- optional parameter -->
--
--
-- The "doc" function will generate the <templatedata> parameter documentation for templates.
-- This way all template parameters can be stored and localized in a single Commons dataset.
-- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons.
--
--
--
--
--
Line 35 ⟶ 43:
for k, v in pairs(frame.args) do
if k == 1 then
dataset = mw.text.trim(v)
elseif k == 2 then
id = mw.text.trim(v)
elseif type(k) == 'number' then
table.insert(params, v)
elseif k == 'lang' and v ~= '_' then
lang = mw.text.trim(v)
end
end
Line 55 ⟶ 63:
-- Given a dataset name, convert it to a title with the 'commons:data:' prefix
function link(dataset)
dataset = 'Data:' .. mw.text.trim(dataset or '')
if mw.site.siteName == 'Wikimedia Commons' then
return dataset
|