This module will transliterate text in the Bengali script.
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:Beng-Deva-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 gsub = mw.ustring.gsub
local export = {}
local conv = {
-- consonants
='क', ='ख', ='ग', ='घ', ='ङ',
='च', ='छ', ='ज', ='झ', ='ञ',
='ट', ='ठ', ='ड', ='ढ', ='ण',
='त', ='थ', ='द', ='ध', ='न',
='प', ='फ', ='ब', ='भ', ='म',
='य', ='र', ='ल', ='ळ', ='श',
='ष', ='स', ='ह',
='ड़', ='ढ़', ='य़', ='त्',
-- maatra
='ा', ='ि', ='ी', ='ु', ='ू', ='ृ', ='ॄ',
='ॢ', ='ॣ', ='े', ='ै', ='ो', ='ौ', ='्', ='़',
-- vowels
='अ', ='आ', ='इ', ='ई', ='उ', ='ऊ', ='ऋ', ='ॠ',
='ऌ', ='ॡ', ='ए', ='ऐ', ='ओ', ='औ',
-- chandrabindu
='ँ',
-- anusvara
='ं',
-- visarga
='ः',
-- avagraha
='ऽ',
--punctuation
='॥',
='।',
='ॐ',
--Vedic extensions
='ᳵ', ='ᳶ',
='०', ='१', ='२', ='३', ='४', ='५', ='६', ='७', ='८', ='९'
}
function export.tr(text, lang, sc, noNuqta)
text = text:gsub("্ব", "्व")
-- Nuqta is not used in Devanagari Sanskrit.
if noNuqta and lang ~= "sa" then
text = text:gsub("ড়", "ড")
:gsub("ঢ়", "ঢ")
:gsub("য়", "য")
end
text = gsub(
text,
".",
function(c)
return conv
end)
return text
end
return export