This module implements the {{ka-IPA}}
template.
local export = {}
local ipa = require("Module:IPA")
local lang = require("Module:languages").getByCode("ka")
local gsub = mw.ustring.gsub
local lower = mw.ustring.lower
local mapping = {
= "a", = "b", = "ɡ", = "d",
= "e", = "v", = "z", = "tʰ",
= "i", = "kʼ", = "l", = "m",
= "n", = "o", = "pʼ", = "ʒ",
= "ɾ", = "s", = "tʼ", = "u",
= "pʰ", = "kʰ", = "ʁ", = "χʼ",
= "ʃ", = "t͡ʃʰ", = "t͡sʰ", = "d͡z",
= "t͡sʼ", = "t͡ʃʼ", = "χ", = "d͡ʒ",
= "h",
= "f" -- special character
}
function export.pronunciation(word)
-- make text lowercase
word = lower(word)
require("Module:script utilities").checkScript(word, "Geor")
-- /v/ is labialised to the previous consonant
word = gsub(word, "()ვ", "%1ʷ")
-- /v/ is devoiced before a devoiced consonant
word = gsub(word, "ვ()", "f%1")
-- /l/ is velarised before a back vowel
word = gsub(word, "ლ()", "ɫ%1")
-- /n/ is velarised before a velar consonant
word = gsub(word, "ნ()", "ŋ%1")
-- word-initial /b, d, ɡ/ are devoiced
local bdg_initial = { = "b̥", = "d̥", = "ɡ̊" }
word = gsub(word, "^()", bdg_initial)
word = gsub(word, "(%s)()", function(s, c) return s .. bdg_initial end)
-- word-final /b, d, ɡ/ are devoiced and aspirated
local bdg_final = { = "ფ", = "თ", = "ქ" }
word = gsub(word, "()$", bdg_final)
word = gsub(word, "()(%s)", function(c, s) return bdg_final .. s end)
word = gsub(word, "%p", "")
word = gsub(word, ".", mapping)
return word
end
function export.show(frame)
local args = frame:getParent().args
local pagetitle = mw.title.getCurrentTitle().text
local p, results = {}, {}
if args then
for _, v in ipairs(args) do
if v == "+" then v = pagetitle end
table.insert(p, (v ~= "") and v or nil)
end
else
if mw.title.getCurrentTitle().nsText == "Template" then
p = {"ქართული ენა"}
else p = { pagetitle } end
end
local has_f = false
for input_index, word in ipairs(p) do
-- check for character ჶ /f/
if mw.ustring.find(word, "ჶ") then
has_f = true
end
local phon = export.pronunciation(word)
table.insert(results, { pron = "" })
local qual = args
if qual then
results.qualifiers = { qual }
end
end
local ret = ipa.format_IPA_full { lang = lang, items = results }
if has_f then
ret = ret .. require("Module:utilities").format_categories("Georgian terms with /f/", lang)
end
return ret
end
return export