Module:User:Malku H₂n̥rés/lang-IPA
- The following documentation is located at Module:User:Malku H₂n̥rés/lang-IPA/documentation. [edit] Categories were auto-generated by Module:documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • testcases • user page • user talk page • userspace
This module generates the phonemic IPA transcription of Lang entries. It runs Template:User:Malku H₂n̥rés/lang-IPA. The testcases are here. It displays the phonemic transcription as well as the dialect1 phonetic transcription.
- The first parameter is the spelling and there can be as many pronunciations as needed.
- If the parameter
|param=
is set tosomething
, this action is done. - The testcases are here.
- The sandbox has a module, a template and testcases.
References
edit- L, F (y) chapter C, in T, p, pages 1-4
local export = {}
local m_IPA = require("Module:IPA")
local lang = require("Module:languages").getByCode("lang")
local s = mw.ustring.gsub
local C = "[consonants]"
local V = "[vowels]"
local c = {
{"", ""},
{"", ""}
}
local dialect1 = {
{"", ""},
{"", ""}
}
function export.pronunciation_phonemic(word)
word = mw.ustring.lower(word)
for a = 1, #c do
word = s(word, c[a][1], c[a][2])
end
return word
end
function export.pronunciation_phonetic(word, dialect)
if dialect == "dialect1" then
for a = 1, #dialect1 do
word = s(word, dialect1[a][1], dialect1[a][2])
end
end
return word
end
function export.show(frame)
local args = frame:getParent().args
local p, results, results_lang = {}, {}, {}
if not args[1] or (args[1] == "") then
error("Please put the word as the first positional parameter!")
else
for index, item in ipairs(args) do
table.insert(p, (item ~= "") and item or nil)
end
end
for _, word in ipairs(p) do
word = export.pronunciation_phonemic(word)
table.insert(results, {pron = "/" .. word .. "/"})
table.insert(results_lang, {pron = "[" .. export.pronunciation_phonetic(word, "dialect1") .. "]"})
end
return "* " .. m_IPA.format_IPA_full { lang = lang, items = results } .. "\n** " .. m_IPA.format_IPA_full { lang = lang, items = results_lang }
--[=[
local results = {}
table.insert(results, {pron = "/" .. export.pronunciation_phonemic(mw.title.getCurrentTitle().text) .. "/"})
return "* " .. require("Module:IPA").format_IPA_full { lang = require("Module:languages").getByCode("akk"), items = results }
--]=]
end
return export