This module will transliterate text in the Multani script. It is used to transliterate Saraiki.
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:Mult-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', ='ñ',
='ṭ', ='ṭh', ='ḍ', ='ḍh', ='ṇ',
='t', ='th', ='d', ='dh', ='n',
='p', ='ph', ='b', ='bh', ='m',
='y', ='r', ='l', ='v',
='s', ='h',
='ǰ', ='ḏ', = 'ṛ', = 'ṛh',
}
local nonconsonants = {
-- vowels
='a', ='i', ='u', ='e',
-- other symbols
='.', -- section mark
-- digits
= '0', = '1', = '2', = '3', = '4',
= '5', = '6', = '7', = '8', = '9',
}
-- 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