မဝ်ဂျူ:kxv-translit
မံက်ပြာကတ်
Testcases
[ပလေဝ်ဒါန်]All tests passed. (refresh)
လိက် | ဗွဲမရံၚ်လၟဳ | မဇေတ်ဍာံ | တၚ်လညာတ်ဂမၠိုၚ် | |
---|---|---|---|---|
ଅଡୁ | oḍu | oḍu | independent ଅ is o | |
ଓଡୁ | oḍu | oḍu | independent ଓ is o | |
ଅ୕ଡୁ | ōḍu | ōḍu | independent ଅ୕ is ō | |
ଓଓଡୁ | ōḍu | ōḍu | independent ଓଓ is ō | |
ଆକୁ | aku | aku | independent ଆ is a | |
ଆ୕କୁ | āku | āku | independent ଆ୕ is ā | |
ଆଆକୁ | āku | āku | independent ଆଆ is ā | |
ଏସ୍କି | eski | eski | independent ଏ is e | |
ଏ୕ସ୍କି | ēski | ēski | independent ଏ୕ is ē | |
ଏଏସ୍କି | ēski | ēski | independent ଏଏ is ē | |
କଡି | koḍi | koḍi | dependent ଅ/ଓ is o | |
କ୕ଡି | kōḍi | kōḍi | dependent ଅ୕ is ō | |
କୋଓଡି | kōḍi | kōḍi | dependent ଓଓ is ō | |
ବାଲା | bala | bala | dependent ଆ is a | |
ବା୕ଲା | bāla | bāla | dependent ଆ୕ is ā | |
ବଆଲା | bāla | bāla | dependent ଆଆ is ā | |
ମେଣ୍ଡା | meṇḍa | meṇḍa | dependent ଏ is e | |
ମେ୕ଣ୍ଡା | mēṇḍa | mēṇḍa | dependent ଏ୕ is ē | |
ମେଏଣ୍ଡା | mēṇḍa | mēṇḍa | dependent ଏଏ is ē | |
ଇଇ | ī | ī | independent ଇଇ is ī | |
ଉଉ | ū | ū | independent ଉଉ is ū | |
କିଇ | kī | kī | dependent ଇଇ is ī | |
କୁଉ | kū | kū | dependent ଉଉ is ū | |
କୁଃଏ | kuʔe | kuʔe | glottal stop ʔ | |
ବିସେୟିଁ | biseyĩ | biseyĩ | chandrabindu |
local export = {}
local gsub = mw.ustring.gsub
local consonants = {
--common
["କ"]="k", ["ଖ"]="kh", ["ଗ"]="g", ["ଘ"]="gh", ["ଙ"]="ṅ",
["ଚ"]="c", ["ଛ"]="ch", ["ଜ"]="j", ["ଝ"]="jh", ["ଞ"]="ñ",
["ଟ"]="ṭ", ["ଠ"]="ṭh", ["ଡ"]="ḍ", ["ଢ"]="ḍh", ["ଣ"]="ṇ",
["ତ"]="t", ["ଥ"]="th", ["ଦ"]="d", ["ଧ"]="dh", ["ନ"]="n",
["ପ"]="p", ["ଫ"]="ph", ["ବ"]="b", ["ଭ"]="bh", ["ମ"]="m",
["ଯ"]="j", ["ୟ"]="y", ["ର"]="r", ["ଲ"]="l", ["ଳ"]="ḷ",
["ଵ"]="v", ["ୱ"]="w", ["ଶ"]="ś", ["ଷ"]="ṣ", ["ସ"]="s", ["ହ"]="h",
--nuktas
["କ଼"]="q", ["ଖ଼"]="x", ["ଗ଼"]="ġ", ["ଜ଼"]="z", ["ଝ଼"]="ź",
["ଡ଼"]="ṛ", ["ଢ଼"]="ṛh", ["ଫ଼"]="f",
}
local diacritics = {
["ା"]="a", ["ି"]="i", ["ୀ"]="ī", ["ୁ"]="u", ["ୂ"]="ū", ["ୃ"]="ru", ["ୄ"]="rū",
["ୢ"]="lu", ["ୣ"]="lū", ["େ"]="e", ["ୈ"]="oi", ["ୖ"]="oi", ["ୋ"]="o", ["ୌ"]="ou", ["ୗ"]="ou",
["୍"]="",
}
local tt = {
-- vowels
["ଅ"]="o", ["ଆ"]="a", ["ଇ"]="i", ["ଈ"]="ī", ["ଉ"]="u", ["ଊ"]="ū", ["ଋ"]="ru", ["ୠ"]="rū",
["ଌ"]="lu", ["ୡ"]="lū", ["ଏ"]="e", ["ଐ"]="oi", ["ଓ"]="o", ["ଔ"]="ou",
-- chandrabindu
["ଁ"]="̃", --until a better method is found
-- anusvara
["ଂ"]="ṁ", --until a better method is found
-- visarga
["ଃ"]="ʔ",
-- avagraha
["ଽ"]="’",
--numerals
["୦"]="0", ["୧"]="1", ["୨"]="2", ["୩"]="3", ["୪"]="4", ["୫"]="5", ["୬"]="6", ["୭"]="7", ["୮"]="8", ["୯"]="9",
["୲"]="¼", ["୳"]="½", ["୴"]="¾", ["୵"]="¹⁄₁₆", ["୶"]="⅛", ["୷"]="³⁄₁₆",
--punctuation
["।"]=".", --danda
}
function export.tr(text, lang, sc)
text = gsub(
text,
"([କଖଗଘଙଚଛଜଝଞଟଠଡଢଣତଥଦଧନପଫବଵଭମଯୟରଲଳୱଶଷସହ]଼?)"..
"([ାିୀୁୂୃୄେୈୖୋୌୗ୍ୢୣ]?)",
function(c, d)
if not consonants[c] then
return c
end
if d == "" then
return consonants[c] .. "o"
else
return consonants[c] .. diacritics[d]
end
end)
text = mw.ustring.gsub(text, ".", tt)
-- anusvara
text = gsub(text, 'ṁ([kqxgġṅ])', 'ṅ%1')
text = gsub(text, 'ṁ([cjźñ])', 'ñ%1')
text = gsub(text, 'ṁ([ṭḍṇ])', 'ṇ%1')
text = gsub(text, 'ṁ([tdnz])', 'n%1')
text = gsub(text, 'ṁ([pfbm])', 'm%1')
-- long vowels
text = gsub(text, '([oaāiue])%1', '%1̄') -- VV → V̄
text = gsub(text, '([oea])୕', '%1̄')
text = gsub(text, 'oa', 'ā')
text = gsub(text, 'aā', 'ā')
return mw.ustring.toNFC(text)
end
return export