Module:IPA
Appearance
![]() | This module depends on the following other modules: |
![]() | This module uses TemplateStyles: |
![]() | This Lua module is used on approximately 164,000 pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
See Template:IPA.
local p = {}
local IPApages = {
["acw"] = "Help:IPA for Hejazi Arabic",
["aeb"] = "Help:IPA for Tunisian Arabic",
["af"] = "Help:IPA for Afrikaans",
["ar"] = "Help:IPA for Arabic",
["as"] = "Help:IPA for Assamese",
["arc"] = "Help:IPA for Aramaic",
["arz"] = "Help:IPA for Egyptian Arabic",
["ast"] = "Help:IPA for Astur-Leonese",
["be"] = "Help:IPA for Belarusian",
["ber"] = "Help:IPA for Berber",
["bg"] = "Help:IPA for Bulgarian and Macedonian",
["bn"] = "Help:IPA for Bengali",
["br"] = "Help:IPA for Breton",
["ca"] = "Help:IPA for Catalan",
["en"] = "Help:IPA for English",
["eu"] = "Help:IPA for Basque",
["hy"] = "Help:IPA for Armenian",
["my"] = "Help:IPA for Burmese",
["sa"] = "Help:IPA for Sanskrit",
["sq"] = "Help:IPA for Albanian",
["tr"] = "Help:IPA for Turkic dialects",
["yue"] = "Help:IPA for Cantonese", -- Wikipedia-specific code
-- [""] = "",
}
-- For pages that describe multiple languages
IPApages["ext"] = IPApages["ast"]
IPApages["mwl"] = IPApages["ast"]
IPApages["tk"] = IPApages["tr"]
IPApages["az"] = IPApages["tr"]
IPApages["at"] = IPApages["tr"]
IPApages["gag"] = IPApages["tr"]
IPApages["mk"] = IPApages["bg"]
-- For pages that describe groups of languages
IPApages["kab"] = IPApages["ber"]
IPApages["rif"] = IPApages["ber"]
-- For aliases of symbols in the main list or other lists
IPApages["bre"] = IPApages["br"]
IPApages["bul"] = IPApages["bg"]
IPApages["mkd"] = IPApages["bg"]
IPApages["mya"] = IPApages["my"]
IPApages["cat"] = IPApages["ca"]
IPApages["san"] = IPApages["sa"]
IPApages["eng"] = IPApages["en"]
--[[
IPApages[""] = IPApages[""]
IPApages[""] = IPApages[""]
]]
local function IPAspan(text)
return '<span title="Representation in the International Phonetic Alphabet (IPA)" class="IPA">'..text..'</span>'
end
function p.IPA(frame)
local languageCode = frame.args[2] and frame.args[1] or nil
local text = languageCode and frame.args[2] or frame.args[1] or error("Please provide IPA to the {{IPA}} template")
local out = IPAspan(text)
out = languageCode and IPApages[languageCode] and "[["..IPApages[languageCode].."|"..out.."]]" or out
return out
end
return p