Module:IPA
Jump to navigation
Jump to search
{{IPA}}
local export = {}
local params = {
[1] = {},
[2] = {list = true},
nolarge = {type = "boolean"},
linked = {type = "boolean"},
}
function export.show(frame)
local args = require("Module:parameters").process(frame:getParent().args, params)
local language = require("Module:languages").get_by_code(args["l"])
if language == nil then
error("No such language: " .. args["l"])
end
local language_pron = "Appendix:" .. language.name .. "_pronunciation"
out = "[[w:International_Phonetic_Alphabet|IPA]]"
out = out .. "<sup>([[" .. language_pron .. "|key]])</sup>: "
local class = "IPA"
if args["nolarge"] then class = class .. " nolarge" end
for i, i_ipa in ipairs(args["ipa"]) do
if i > 1 then out = out .. ", " end
out = out .. '<span class="' .. class .. '">'
if args["linked"] then
out = out .. "[[" .. language_pron .. "|" .. i_ipa .. "]]"
else
out = out .. i_ipa
end
out = out .. "</span>"
end
return out
end
return export