This module will transliterate text in the Tibetan 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:Tibt-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 = {
='क', ='क़', ='ख', ='ग', ='ङ',
='च्य', ='छ्य', ='ज्य', ='अ',
='च', ='छ', ='ज', ='ञ', ='श़', ='स़',
='ट', ='ठ', ='ड', ='ण',
='त', ='थ', ='द', ='न', ='अ',
='प', ='फ', ='ब', ='भ', ='म',
='य', ='र', ='ड़', ='ल', ='श', ='व',
='ष', ='स', ='ह', ='्य',
='ा', ='ि', ='ु', ='े', ='ो', ='ै',
='ौ', ='्', =' ',
-- chandrabindu
='ँ',
-- anusvara
='ं',
-- visarga
='ः',
-- avagraha
='ऽ',
--punctuation
='॥',
='।',
='ॐ',
--Vedic extensions
='ᳵ', ='ᳶ',
}
function export.tr(text, lang, sc)
text = gsub(
text,
".",
function(c)
return conv
end)
text = gsub(text, 'गྷ', "घ")
text = gsub(text, 'जྷ', "झ")
text = gsub(text, 'डྷ', "ढ")
text = gsub(text, 'दྷ', "ध")
text = gsub(text, 'बྷ', "भ")
text = gsub(text, 'लྷ', "ल्ह")
text = gsub(text, 'रྷ', "र्ह")
text = gsub(text, 'बྷ', "ह्")
text = gsub(text, 'ྭ', "्व")
text = gsub(text, 'ྲ', "्र")
text = gsub(text, 'ྐ', "्क")
text = gsub(text, 'ྑ', "्ख")
text = gsub(text, 'ྒ', "्ग")
text = gsub(text, 'ྒྷ', "्घ")
text = gsub(text, 'ྜྷ', "्ढ")
text = gsub(text, 'ྡྷ', "्ध")
text = gsub(text, 'ྦྷ', "्भ")
text = gsub(text, 'ྔ', "्ङ")
text = gsub(text, 'ྟ', "्त")
text = gsub(text, 'ྠ', "्थ")
text = gsub(text, 'ྡ', "्द")
text = gsub(text, 'ྚ', "्ट")
text = gsub(text, 'ྛ', "्ठ")
text = gsub(text, 'ྜ', "्ड")
text = gsub(text, 'ྣ', "्न")
text = gsub(text, 'ྤ', "्प")
text = gsub(text, 'ྥ', "्फ")
text = gsub(text, 'ྦ', "्ब")
text = gsub(text, 'ྨ', "्म")
text = gsub(text, 'ྙ', "्ञ")
text = gsub(text, 'ྩ', "्च")
text = gsub(text, 'ྪ', "्छ")
text = gsub(text, 'ྫ', "्ज")
text = gsub(text, 'ྕ', "्च्य")
text = gsub(text, 'ྖ', "्छ्य")
text = gsub(text, 'ྗ', "्ज्य")
text = gsub(text, 'ླ', "्ल")
text = gsub(text, 'ྴ', "्श")
text = gsub(text, 'ྶ', "्स")
text = gsub(text, 'ྵ', "्ष")
text = gsub(text, 'ྸ', "्अ")
text = gsub(text, 'रྀ', "ऋ")
text = gsub(text, 'राྀ', "ॠ")
text = gsub(text, '्ऋ', "ृ")
text = gsub(text, '्ॠ', "ॄ")
text = gsub(text, 'अा', "आ")
text = gsub(text, 'अि', "इ")
text = gsub(text, 'ाि', "ी")
text = gsub(text, 'आि', "ई")
text = gsub(text, 'अु', "उ")
text = gsub(text, 'ाु', "ू")
text = gsub(text, 'आु', "ऊ")
text = gsub(text, 'अे', "ए")
text = gsub(text, 'अै', "ऐ")
text = gsub(text, 'अो', "ओ")
text = gsub(text, 'अौ', "औ")
return text
end
return export