Module:T/forms/sandbox

--

-- Data for Module:T. See Global Lua Modules/T/schema for the schema. -- -- @todo --    Some languages appear to have multiple titles per form. I should --    investigate this further and, if necessary, adjust the data to --     compensate. -- -- @todo --    Figure out how case-sensitivity works across languages. I would like to --    remove the `caseSensitive` field if possible, because doing so might --    allow me to use Dev:I18n instead of this hand-rolled nonsense. -- -- @todo Add missing i18n. -- @todo Add missing forms. -- -- I18n sources: --    * app/extensions/ParserFunctions/ParserFunctions.i18n.magic.php --    * app/extensions/Scribunto/Scribunto.magic.php --    * app/languages/messages/*.php

local forms = {}

-- helper function to make the same form available from multiple titles local function Form(data) for langCode, langData in pairs(data.i18n) do       if not forms[langCode] then forms[langCode] = {} end

local alias = langData.title and mw.ustring.lower(langData.title) or "default"

-- prevent name clashes -- users should never see this message if forms[langCode][alias] then error(               "duplicate form with title `" ..                title ..                "` under language code `" ..                langCode ..                "` in Dev:T/data"            ) end

forms[langCode][alias] = langData forms[langCode][alias].args = data.args end end

Form { i18n = { ["ar"] = { title = "عام_حالي", target = "mw:Help:Help:Magic words/ar#CURRENTYEAR", caseSensitive = true, },       ["en"] = { title = "CURRENTYEAR", target = "mw:Help:Help:Magic words#CURRENTYEAR", caseSensitive = true, },   },    args = { firstDelimiter = true, required = {"link"}, optional = nil, rest = nil, }, }

Form { i18n = { ["ar"] = { title = "#استدعاء:", target = "وحدة:%s", caseSensitive = false, },       ["en"] = { title = "#invoke:", target = "Module:%s", caseSensitive = false, },   },    args = { firstDelimiter = false, required = {"syntax", "link", "syntax"}, optional = nil, rest = "namedParam", }, }

Form { i18n = { ["ar"] = { title = "#لو:", target = "mw:Help:Extension:ParserFunctions/ar##if", caseSensitive = false, },       ["en"] = { title = "#if:", target = "mw:Help:Extension:ParserFunctions##if", caseSensitive = false, },   },    args = { firstDelimiter = false, required = {"link"}, optional = {"unnamedParam", "unnamedParam", "unnamedParam"}, rest = nil, }, }

Form { i18n = { ["ar"] = { title = "#تبديل:", target = "mw:Help:Extension:ParserFunctions/ar##switch", caseSensitive = false, },       ["en"] = { title = "#switch:", target = "mw:Help:Extension:ParserFunctions##switch", caseSensitive = false, },   },    args = { firstDelimiter = false, required = {"link"}, optional = {"unnamedParam"}, rest = "namedParam", }, }

Form { i18n = { ["ar"] = { title = nil, target = "قالب:%s", caseSensitive = true, },       ["en"] = { title = nil, target = "Template:%s", caseSensitive = true, },   },    args = { firstDelimiter = true, required = {"link"}, optional = nil, rest = "namedParam", }, }

return forms