This module will transliterate text in the Mahajani script. It is used to transliterate Marwari.
The module should preferably not be called directly from templates or other modules.
To use it from a template, use {{xlit}}
.
Within a module, use Module:languages#Language:transliterate.
For testcases, see Module:Mahj-translit/testcases.
tr(text, lang, sc)
text
written in the script specified by the code sc
, and language specified by the code lang
.nil
.local export = {}
local consonants = {
='k', ='kh', ='g', ='gh',
='c', ='ch', ='j', ='jh', ='ñ',
='ṭ', ='ṭh', ='ḍ', ='ḍh', ='ṇ',
='t', ='th', ='d', ='dh', ='n',
='p', ='ph', ='b', ='bh', ='m',
='r', ='l', ='v',
='s', ='h', = 'ṛ',
}
local nonconsonants = {
-- vowels
='a', ='i', ='u', ='e', ='o',
-- other symbols
='.', -- abbreviation mark
='§', -- section mark
='Shri', -- ligature ]
}
-- translit any words or phrases
function export.tr(text, lang, sc)
text = mw.ustring.gsub(
text,
'()'..
'(?)',
function(c, d)
-- mw.log('match', c, d)
return (consonants or c)
end)
text = mw.ustring.gsub(text, '.', nonconsonants)
return text
end
return export