মডিউল:blk-translit
অবয়ব
এই মডিউলের জন্য মডিউল:blk-translit/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে
local export = {}
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local letter_with_mark = '(.['..u(0x0300)..'-'..u(0x036F)..']?)'
local pre = {
['ျ'] = '္ယ', ['ြ'] = '္ရ', ['ွ'] = '္ဝ', ['ှ'] = '္ဟ',
}
local tt1 = {
-- consonants
['က'] = 'k', ['ခ'] = 'h̄h', ['ဂ'] = 'kh', ['ဃ'] = 'ḳh', ['င'] = 'ng',
['စ'] = 'c', ['ဆ'] = 'c̄h', ['ဇ'] = 'ch', ['ဈ'] = 'c̣h', ['ဉ'] = 'ỵ', ['ည'] = 'ỵ',
['ဋ'] = 't̩', ['ဌ'] = 'ṭ̄', ['ဍ'] = 'ṯh', ['ဎ'] = 'tʹh', ['ဏ'] = 'ṇ',
['တ'] = 't', ['ထ'] = 't̄h', ['ဒ'] = 'th', ['ဓ'] = 'ṭh', ['န'] = 'n',
['ပ'] = 'p', ['ဖ'] = 'p̄h', ['ဗ'] = 'ph', ['ဘ'] = 'p̣h', ['မ'] = 'm',
['ယ'] = 'y', ['ရ'] = 'r', ['လ'] = 'l', ['ဝ'] = 'w', ['သ'] = 's̄',
['ဟ'] = 'h̄', ['ဠ'] = 'ḷ', ['အ'] = 'x',
-- independent vowels (1)
['ဣ'] = 'xi', ['ဤ'] = 'xī', ['ဥ'] = 'xu', ['ဦ'] = 'xū', ['ဩ'] = 'xeā',
-- dependent vowels and diacritics (excluding front type)
['ါ'] = 'ā', ['ာ'] = 'ā', ['ိ'] = 'i', ['ီ'] = 'ī', ['ု'] = 'u', ['ူ'] = 'ū',
['ံ'] = 'ํ', ['့'] = '̥', ['း'] = ':', ['ႏ'] = '⁏', ['ꩻ'] = '⹁', ['္'] = 'ฺ', ['်'] = '์',
-- numerals
['၀'] = '0', ['၁'] = '1', ['၂'] = '2', ['၃'] = '3', ['၄'] = '4',
['၅'] = '5', ['၆'] = '6', ['၇'] = '7', ['၈'] = '8', ['၉'] = '9',
-- zero-width space (display it if it hides in a word)
[u(0x200B)] = '‼',
}
local adjust1 = {
-- dependent vowels (front type)
['ေ'] = 'e%1', ['ဲ'] = 'æ%1',
}
function export.tr(text, lang, sc, debug_mode)
if type(text) == 'table' then -- called directly from a template
text = text.args[1]
end
text = gsub(text, '.', pre)
text = gsub(text, '.', tt1)
for k, v in pairs(adjust1) do
text = gsub(text, letter_with_mark..k, v)
end
return text
end
return export