Module:TNT: Difference between revisions
From PegasusXI Wiki
imported>BG-Wiki import Imported from the BG-Wiki archive (CC BY-NC-SA 3.0) |
imported>BG-Wiki import Imported from the BG-Wiki archive (CC BY-NC-SA 3.0) |
(No difference)
| |
Latest revision as of 17:39, 1 March 2021
Documentation for this module may be created at Module:TNT/doc
-- Monolingual stand-in for Module:TNT.
--
-- Generated by scripts/build-tnt-shim.mjs from the English column of the Commons datasets
-- Data:I18n/Documentation.tab and Data:I18n/No_globals.tab. Do not edit here; regenerate instead.
--
-- The real Module:TNT resolves messages through the JsonConfig extension's Data: namespace. This
-- wiki is English-only and does not install JsonConfig, so the strings are embedded directly and
-- the translation machinery is dropped. Only format() is implemented, because that is the entire
-- API the imported modules call.
local p = {}
local messages = {}
messages["I18n/Documentation"] = {
["cfg-error-msg-type"] = "message: type error in message cfg.$1 ($2 expected, got $3)",
["cfg-error-msg-empty"] = "message: no value found for key $1 in message cfg.$2",
["template-namespace-heading"] = "Template documentation",
["module-namespace-heading"] = "Module documentation",
["file-namespace-heading"] = "Summary",
["other-namespaces-heading"] = "Documentation",
["view-link-display"] = "view",
["edit-link-display"] = "edit",
["history-link-display"] = "history",
["purge-link-display"] = "purge",
["create-link-display"] = "create",
["sandbox-notice-pagetype-template"] = "[[wikipedia:Wikipedia:Template sandbox and test cases|template sandbox]] page",
["sandbox-notice-pagetype-module"] = "[[wikipedia:Wikipedia:Template sandbox and test cases|module sandbox]] page",
["sandbox-notice-pagetype-other"] = "sandbox page",
["sandbox-notice-blurb"] = "This is the $1 for $2.",
["sandbox-notice-diff-blurb"] = "This is the $1 for $2 ($3).",
["sandbox-notice-compare-link-display"] = "diff",
["sandbox-notice-testcases-blurb"] = "See also the companion subpage for $1.",
["sandbox-notice-testcases-link-display"] = "test cases",
["sandbox-notice-testcases-run-blurb"] = "See also the companion subpage for $1 ($2).",
["sandbox-notice-testcases-run-link-display"] = "run",
["transcluded-from-blurb"] = "The above [[wikipedia:Wikipedia:Template documentation|documentation]] is [[wikipedia:Wikipedia:Transclusion|transcluded]] from $1.",
["create-module-doc-blurb"] = "You might want to $1 a documentation page for this [[wikipedia:Wikipedia:Lua|Scribunto module]].",
["experiment-blurb-template"] = "Editors can experiment in this template’s $1 and $2 pages.",
["experiment-blurb-module"] = "Editors can experiment in this module’s $1 and $2 pages.",
["sandbox-link-display"] = "sandbox",
["sandbox-edit-link-display"] = "edit",
["sandbox-create-link-display"] = "create",
["compare-link-display"] = "diff",
["mirror-link-display"] = "mirror",
["testcases-link-display"] = "testcases",
["testcases-edit-link-display"] = "edit",
["testcases-create-link-display"] = "create",
["add-categories-blurb"] = "Please add categories to the $1 subpage.",
["subpages-blurb"] = "$1.",
["subpages-link-display"] = "Subpages of this $1",
["template-pagetype"] = "template",
["module-pagetype"] = "module",
["default-pagetype"] = "page",
["print-blurb"] = "A [[wikipedia:Help:Books/for experts#Improving the book layout|print version]] of this template exists at $1. If you make a change to this template, please update the print version as well.",
}
messages["I18n/No globals"] = {
["err-read"] = "Tried to read nil global $1",
["err-write"] = "Tried to write global $1",
}
-- Dataset names are written with and without the .tab suffix depending on the caller.
local function lookup(dataset, key)
local set = messages[dataset] or messages[(dataset or ""):gsub("%.tab$", "")]
return set and set[key] or nil
end
-- Mirrors mw.message-style $1, $2 ... substitution.
local function substitute(text, args)
return (text:gsub("%$(%d+)", function(n)
local v = args[tonumber(n)]
return v ~= nil and tostring(v) or ("$" .. n)
end))
end
function p.format(dataset, key, ...)
local text = lookup(dataset, key)
if not text then
-- Matches upstream behaviour closely enough to be recognisable while debugging.
return "<" .. tostring(dataset) .. "/" .. tostring(key) .. ">"
end
return substitute(text, { ... })
end
-- Accepted aliases so callers written against the real module keep working.
function p.formatInLanguage(_lang, dataset, key, ...)
return p.format(dataset, key, ...)
end
function p.msg(frame)
local args = frame.args or {}
local rest = {}
for i = 3, #args do rest[#rest + 1] = args[i] end
return p.format(args[1], args[2], unpack(rest))
end
return p
