Module:ka-IPA

Avy amin'i Wikibolana — Rakibolana malagasy malalaka

La documentation pour ce module peut être créée à Module:ka-IPA/doc

local export = {}

local m_IPA = require("Module:IPA")

local lang = require("Module:languages").getByCode("ka")

--source: Standard Georgian by Shosted, Ryan K and Chikovani, Vakhtang

local IPA_mapping = {
	["ა"] = "a", ["ბ"] = "b", ["გ"] = "ɡ", ["დ"] = "d",
	["ე"] = "ɛ", ["ვ"] = "v", ["ზ"] = "z", ["თ"] = "tʰ",
	["ი"] = "i", ["კ"] = "kʼ", ["ლ"] = "l", ["მ"] = "m",
	["ნ"] = "n", ["ო"] = "ɔ", ["პ"] = "pʼ", ["ჟ"] = "ʒ",
	["რ"] = "r", ["ს"] = "s", ["ტ"] = "tʼ", ["უ"] = "u",
	["ფ"] = "pʰ", ["ქ"] = "kʰ", ["ღ"] = "ɣ", ["ყ"] = "qʼ",
	["შ"] = "ʃ", ["ჩ"] = "t͡ʃ", ["ც"] = "t͡s", ["ძ"] = "d͡z",
	["წ"] = "t͡sʼ", ["ჭ"] = "t͡ʃʼ", ["ხ"] = "x", ["ჯ"] = "d͡ʒ",
	["ჰ"] = "h"
}

function export.pronunciation(word)
    word = mw.ustring.lower(word)

    word = mw.ustring.gsub(word, "%p", "")

    word = mw.ustring.gsub(word, ".", IPA_mapping)

    return word
end

function export.show(frame)
    local args = frame:getParent().args
    local pagetitle = mw.title.getCurrentTitle().text

    local p, results = {}, {}

    if args[1] then
        for index, item in ipairs(args) do
            table.insert(p, (item ~= "") and item or nil)
        end
    else
        p = {pagetitle}
    end

    for _, word in ipairs(p) do
        table.insert(results, {pron = "/" .. export.pronunciation(word) .. "/"})
    end

    return m_IPA.format_IPA_full(lang, results)
end

return export