local U = mw.ustring.char
local caron = U(0x30C) -- caron
local circumflex = U(0x302) -- circumflex
local diaeresis = U(0x308) -- diaeresis
local macron = U(0x304) -- macron
local ring_above = U(0x30A) -- ring above
local data = {
{
["ā" .. macron] = "а̄", -- ā
["ɣ" .. caron] = "г̌", -- ɣ̌
["e" .. macron] = "е", -- ē
["e" .. circumflex] = "е̂", -- ê
["e" .. circumflex] = "е̂", -- ê
["a" .. diaeresis .. macron] = "е̂", -- ǟ
["z" .. caron] = "з̌", -- ž
["i" .. macron] = "ӣ", -- ī
["o" .. macron] = "о", -- ō
["u" .. macron] = "ӯ", -- ū
["u" .. macron .. ring_above] = "у̊", -- ū̊
["x" .. caron] = "х̌", -- x̌
["c" .. caron] = "ч", -- č
["j" .. caron] = "ҷ", -- ǰ
["s" .. caron] = "ш", -- š
},
{
["a"] = "а",
["ā"] = "а̄",
["b"] = "б",
["v"] = "в",
["w"] = "в̌",
["g"] = "г",
["ɣ"] = "ғ",
["ɣ̌"] = "г̌",
["d"] = "д",
["δ"] = "д̌",
["ē"] = "е",
["ê"] = "е̂", ["ǟ"] = "е̂",
["z"] = "з",
["ž"] = "з̌",
["i"] = "и",
["ī"] = "ӣ",
["y"] = "й",
["k"] = "к",
["q"] = "қ",
["l"] = "л",
["m"] = "м",
["n"] = "н",
["ō"] = "о",
["p"] = "п",
["r"] = "р",
["s"] = "с",
["t"] = "т",
["θ"] = "т̌",
["u"] = "у",
["ū"] = "ӯ",
["ū̊"] = "у̊",
["f"] = "ф",
["x"] = "х",
["h"] = "ҳ",
["x̌"] = "х̌",
["c"] = "ц",
["č"] = "ч",
["ǰ"] = "ҷ",
["š"] = "ш",
},
}
-- Add replacements for capitals: both an all-caps version ("JA")
-- and capitalized version ("Ja").
for _, replacements in ipairs(data) do
-- sortedPairs saves the list of table keys so that we can modify the table
-- while iterating over it.
for text, replacement in require "Module:table".sortedPairs(replacements) do
replacement = mw.ustring.upper(replacement)
replacements[mw.ustring.upper(text)] = replacement
replacements[mw.ustring.gsub(text, "^.", mw.ustring.upper)] = replacement
end
end
return data