Module:Deva-Mong-translit
Appearance
- පහත දැක්වෙන උපදෙස්, Module:documentation/functions/translit මගින් ජනනය කොට ඇත. [සංස්කරණය කරන්න]
- ප්රයෝජනවත් සබැඳි: උප පිටු ලැයිස්තුව • සබැඳි • transclusions • testcases • sandbox
This module will transliterate text in the දේවනාගරි අක්ෂරක්රමය.
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:Deva-Mong-translit/testcases.
Functions
[සංස්කරණය]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 tt = {
{"(.[ःा-ॄेैो-्ॢॣ]*)([ँं])", "%2%1"}, {"(.[ःा-ॄेैो-्ॢॣ]*)(ऽ+)", "%2%1"},
{"क", "ᢉᠠ"}, {"ख", "ᠻᠠ"}, {"ग", "ᠺᠠ"}, {"घ", "ᠺᠾᠠ"}, {"ङ", "ᢊᠠ"},
{"च", "ᢋᠠ"}, {"छ", "ᠼᠠ"}, {"ज", "ᠽᠠ"}, {"झ", "ᠽᠾᠠ"}, {"ञ", "ᡛᠠ"},
{"ट", "ᢌᠠ"}, {"ठ", "ᢍᠠ"}, {"ड", "ᢎᠠ"}, {"ढ", "ᢎᠾᠠ"}, {"ण", "ᢏᠠ"},
{"त", "ᢐᠠ"}, {"थ", "ᠲᠠ"}, {"द", "ᢑᠠ"}, {"ध", "ᢑᠾᠠ"}, {"न", "ᠨᠠ"},
{"प", "ᢒᠠ"}, {"फ", "ᠹᠠ"}, {"ब", "ᠪᠠ"}, {"भ", "ᠪᠾᠠ"}, {"म", "ᠮᠠ"},
{"य", "ᠶ᠋ᠠ"}, {"र", "ᠷᠠ"}, {"ल", "ᠯᠠ"}, {"व", "ᠸᠠ"},
{"श", "ᠱᠠ"}, {"ष", "ᢔᠠ"}, {"स", "ᠰᠠ"}, {"ह", "ᠾᠠ"},
{"अ", "ᠠ"}, {"आ", "ᠠᢗ"}, {"इ", "ᢈ"}, {"ई", "ᢈᢈ"}, {"उ", "ᠤ"}, {"ऊ", "ᠤᠤ"}, {"ऋ", "ᠷᢈ"}, {"ॠ", "ᠷᢈᢈ"},
{"ऌ", "ᠯᢈ"}, {"ॡ", "ᠯᢈᢈ"}, {"ए", "ᠧ"}, {"ऐ", "ᠧᠧ"}, {"ओ", "ᠣᠸᠠ"}, {"औ", "ᠣᠸᠸᠠ"},
{"ँ", "ᢀ"}, {"ं", "ᢀ᠋"}, {"ः", "ᢁ᠋"}, {"ऽऽऽ", "ᢆ"}, {"ऽ", "ᢅ"},
{"०", "᠐"}, {"१", "᠑"}, {"२", "᠒"}, {"३", "᠓"}, {"४", "᠔"}, {"५", "᠕"}, {"६", "᠖"}, {"७", "᠗"}, {"८", "᠘"}, {"९", "᠙"},
{"॥", "᠃ "}, {"।", "᠂ "},
{"ᳵ", "ᢂ"}, {"ᳶ", "ᢄ"},
{"ॐ", "ᢀᠣᠸᠠ"},
{"-", "᠊"},
{"(्)ᠸᠠ([^िीुूृॄेैोौ्ॢॣ])", "%1ᢦ%2"}, {"(्)ᠸᠠ$", "%1ᢦ"}, {"(्)ᠶ᠋ᠠ(ा?%s)", "%1ᠶᠠ%2"}, {"(्)ᠶ᠋ᠠ(ा?)$", "%1ᠶᠠ%2"},
{"ᠠा", "ᠠᢗ"}, {"ᠠि", "ᢈ"}, {"ᠠी", "ᢈᢈ"}, {"ᠠु", "ᠤ"}, {"ᠠू", "ᠤᠤ"}, {"ᠠृ", "ᠷᢈ"}, {"ᠠॄ", "ᠷᢈᢈ"},
{"ᠠॢ", "ᠯᢈ"}, {"ᠠॣ", "ᠯᢈᢈ"}, {"ᠠे", "ᠧ"}, {"ᠠै", "ᠧᠧ"}, {"ᠠो", "ᠣᠸᠠ"}, {"ᠠौ", "ᠣᠸᠸᠠ"}, {"ᠠ्", ""}, {"ᢦा", "ᢦᠠ"},
{"ᠯᠾ", "ᡀ"},
{"ᠠᢗ([^᠊ᠠ-ᡸᢇ-ᢪ])", "ᠠᠠ%1"}, {"ᠠᢗ$", "ᠠᠠ"}, {"^ᠠ([^᠊ᠠ-ᡸᢇ-ᢪ])", "ᠠ᠋%1"}, {"([^ᠪᠹᠺᠻᢉᢒ])ᠠ([^᠊ᠠ-ᡸᢇ-ᢪ])", "%1ᠠ᠋%2"}, {"^ᠠ$", "ᠠ᠋"}, {"([^ᠪᠹᠺᠻᢉᢒ])ᠠ$", "%1ᠠ᠋"}, {"(ᠣᠸᠸ?ᠠ)᠋", "%1"},
{"([ᢅᢆ])(.᠋?)", "%2%1"},
{"\n", " "}, {"<br>", " "},
{" ([᠃᠂])", "%1"},
{" +", " "}, {"^ +(.*)", "%1"}, {"(.*) +$", "%1"}
}
function export.tr(text)
text = mw.ustring.lower(text)
for _, replacement in ipairs(tt) do
text = mw.ustring.gsub(text, replacement[1], replacement[2])
end
return text
end
return export