Module:User:Erutuon/t-simple
Appearance
- The following documentation is located at Module:User:Erutuon/t-simple/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
{{t-simple|la|nasus|alt=nāsus|langname=Latin}}
local export = {}
function export.show(frame)
local params = {
[1] = { required = true }, -- language code
[2] = { required = true }, -- term
[3] = { alias_of = "g" }, -- gender
g = { list = true },
alt = {}, -- displayed text
tr = {}, -- transliteration
lit = {}, -- literal translation
id = {}, -- sense id
}
local args = require "Module:parameters".process(frame.args, params, true)
local lang = require "Module:languages".getByCode(args[1])
or require "Module:languages".err(args[1], 1)
local output = require "Module:array" "{{t-simple"
local alt = args.alt
if not alt then
entry_name = lang:makeEntryName(args[2])
if entry_name ~= args[2] then
args[2], alt = entry_name, args[2]
end
end
for _, param in ipairs {
{ 1, lang:getCode() },
{ 2, args[2] },
{ "alt", alt },
{ "sc", args.sc },
{ "g", args.g[1] },
{ "tr", args.tr },
{ "langname", lang:getCanonicalName() },
} do
local key, value = unpack(param)
if value then
if type(key) == "number" then
output:insert("|" .. value)
else
output:insert("|" .. key .. "=" .. value)
end
end
end
output:insert "}}"
return output:concat()
end
return export