Module:Newa-Deva-translit
Jump to navigation
Jump to search
- The following documentation is generated by Module:documentation/functions/translit. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate text in the Newa 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:Newa-Deva-translit/testcases.
Functions
[edit]tr(text, lang, sc)
- Transliterates a given piece of
text
written in the script specified by the codesc
, and language specified by the codelang
. - When the transliteration fails, returns
nil
.
local export = {}
local gsub = mw.ustring.gsub
local conv = {
['𑐎']='क', ['𑐏']='ख', ['𑐐']='ग', ['𑐑']='घ', ['𑐒']='ङ',
['𑐔']='च', ['𑐕']='छ', ['𑐖']='ज', ['𑐗']='झ', ['𑐘']='ञ',
['𑐚']='ट', ['𑐛']='ठ', ['𑐜']='ड', ['𑐝']='ढ', ['𑐞']='ण',
['𑐟']='त', ['𑐠']='थ', ['𑐡']='द', ['𑐢']='ध', ['𑐣']='न',
['𑐥']='प', ['𑐦']='फ', ['𑐧']='ब', ['𑐨']='भ', ['𑐩']='म',
['𑐫']='य', ['𑐬']='र', ['𑐮']='ल', ['𑐰']='व', ['𑐱']='श',
['𑐲']='ष', ['𑐳']='स', ['𑐴']='ह',
-- breathy
['𑐤']='न्ह', ['𑐓']='ङ्ह', ['𑐭']='र्ह', ['𑐯']='ल्ह', ['𑐪']='म्ह', ['𑐙']='ञ्ह',
['𑐵']='ा', ['𑐶']='ि', ['𑐷']='ी', ['𑐸']='ु', ['𑐹']='ू', ['𑐺']='ृ', ['𑐻']='ॄ',
['𑐼']='ॢ', ['𑐽']='ॣ', ['𑐾']='े', ['𑐿']='ै', ['𑑀']='ो', ['𑑁']='ौ', ['𑑂']='्', ['𑑆']='़',
-- vowels
['𑐀']='अ', ['𑐁']='आ', ['𑐂']='इ', ['𑐃']='ई', ['𑐄']='उ', ['𑐅']='ऊ', ['𑐆']='ऋ', ['𑐇']='ॠ',
['𑐈']='ऌ', ['𑐉']='ॡ', ['𑐊']='ए', ['𑐋']='ऐ', ['𑐌']='ओ', ['𑐍']='औ',
-- chandrabindu
['𑑃']='ँ',
-- anusvara
['𑑄']='ं', ['𑑈']='ं',
-- visarga
['𑑅']='ः',
-- avagraha
['𑑇']='ऽ',
--punctuation
['𑑏']='॰',
['𑑌']='॥',
['𑑋']='।',
['𑑉']='ॐ',
--Vedic extensions
['𑑠']='ᳵ', ['𑑡']='ᳶ',
['𑑐']='०', ['𑑑']='१', ['𑑒']='२', ['𑑓']='३', ['𑑔']='४', ['𑑕']='५', ['𑑖']='६', ['𑑗']='७', ['𑑘']='८', ['𑑙']='९'
}
function export.tr(text, lang, sc)
text = gsub(
text,
".",
function(c)
return conv[c]
end)
return text
end
return export