မဝ်ဂျူ:gon-Gonm-translit
မံက်ပြာကတ်
Masaram Gondi transliteration module.
Testcases
[ပလေဝ်ဒါန်]Module:gon-Gonm-translit/testcases:
All tests passed. (refresh)
လိက် | ဗွဲမရံၚ်လၟဳ | မဇေတ်ဍာံ | တၚ်လညာတ်ဂမၠိုၚ် | |
---|---|---|---|---|
𑴦𑴶 | r̥ | r̥ | independent <r̥> represented by independent <r> + dependent <r̥> | |
𑴨𑴘𑵂𑴳 | vaṛī | vaṛī | <ṛ> represented as 𑴘𑵂 | |
𑴀𑴎𑵅𑴎 | agga | agga | virama | |
𑴌𑴱𑴖𑵄 | kāṭ | kāṭ | word-final halanta | |
𑴌𑴵𑴥𑵄𑴫𑴱 | kūysā | kūysā | word-medial halanta | |
𑴀𑵆𑴝𑴽 | ardo | ardo | repha | |
𑴑𑴱𑴠𑵇𑴱 | cāprā | cāprā | ra-kāra | |
𑴆𑵃 | ĕ | ĕ | <ऍ> ĕ independent | |
𑴁𑵃 | ŏ | ŏ | <ऑ> ŏ independent | |
𑴌𑵃 | kĕ | kĕ | <ऍ> ĕ dependent | |
𑴌𑴱𑵃 | kŏ | kŏ | <ऑ> ŏ dependent |
local export = {}
local gsub = mw.ustring.gsub
local consonants = {
['𑴌'] = 'k', ['𑴍'] = 'kh', ['𑴎'] = 'g', ['𑴏'] = 'gh', ['𑴐'] = 'ṅ',
['𑴑'] = 'c', ['𑴒'] = 'ch', ['𑴓'] = 'j', ['𑴔'] = 'jh', ['𑴕'] = 'ñ',
['𑴖'] = 'ṭ', ['𑴗'] = 'ṭh', ['𑴘'] = 'ḍ', ['𑴙'] = 'ḍh', ['𑴚'] = 'ṇ',
['𑴛'] = 't', ['𑴜'] = 'th', ['𑴝'] = 'd', ['𑴞'] = 'dh', ['𑴟'] = 'n',
['𑴠'] = 'p', ['𑴡'] = 'ph', ['𑴢'] = 'b', ['𑴣'] = 'bh', ['𑴤'] = 'm',
['𑴥'] = 'y', ['𑴦'] = 'r', ['𑴧'] = 'l', ['𑴨'] = 'v', ['𑴭'] = 'ḷ',
['𑴩'] = 'ś', ['𑴪'] = 'ṣ', ['𑴫'] = 's', ['𑴬'] = 'h',
['𑴮'] = 'kṣ', ['𑴯'] = 'jñ', ['𑴰'] = 'tr',
['𑴘𑵂'] = 'ṛ',
}
local diacritics = {
['𑴱'] = 'ā', ['𑴲'] = 'i', ['𑴳'] = 'ī', ['𑴴'] = 'u', ['𑴵'] ='ū', ['𑴶'] = 'r̥',
['𑴺'] = 'e', ['𑴼'] = 'ai', ['𑴽'] ='o', ['𑴿'] = 'au', ['𑵄'] = '', ['𑵅'] = '',
}
local tt = {
-- vowels
['𑴀'] = 'a' , ['𑴁'] = 'ā' , ['𑴂'] = 'i' , ['𑴃'] = 'ī' , ['𑴄']='u' , ['𑴅'] = 'ū',
['𑴆'] = 'e', ['𑴈'] = 'ai' , ['𑴉'] = 'o', ['𑴋'] = 'au',
-- other symbols
['𑵀'] = 'ṁ', -- anusvara
['𑵁'] = 'ḥ', -- visarga
['𑵃'] = '̃', -- chandra
-- digits
['𑵐'] = '0', ['𑵑'] = '1', ['𑵒'] = '2', ['𑵓'] = '3', ['𑵔'] = '4',
['𑵕'] = '5', ['𑵖'] = '6', ['𑵗'] = '7', ['𑵘'] = '8', ['𑵙'] = '9',
}
-- translit any words or phrases
function export.tr(text, lang, sc)
text = gsub(text, '𑵇', '𑵄𑴦') -- ra-kāra
text = gsub(
text,
'([𑴌-𑴰]𑵂?)'..
'([[𑴱𑴲𑴳𑴴𑴵𑴶𑴺𑴼𑴽𑴿𑵀𑵁𑵄𑵅]?)',
function(c, d)
if d == "" then
return consonants[c] .. 'a'
else
return consonants[c] .. diacritics[d]
end
end)
text = gsub(text, '.', tt)
-- anusvara
text = gsub(text, 'ṁ([kgṅ])', 'ṅ%1')
text = gsub(text, 'ṁ([cjñ])', 'ñ%1')
text = gsub(text, 'ṁ([ṭḍṇ])', 'ṇ%1')
text = gsub(text, 'ṁ([tdn])', 'n%1')
text = gsub(text, 'ṁ([pbm])', 'm%1')
text = gsub(text, 'rr̥', 'r̥') -- 𑴦𑴶 is independent r̥
text = gsub(text, '𑵆', 'r') -- repha
text = gsub(text, '[ea]̃', 'ĕ') -- <ऍ> ĕ independent and dependent
text = gsub(text, 'ā̃', 'ŏ') -- <ऑ> ŏ independent and dependent
return text
end
return export