Modul:Mtei-translit
Penampilan
- Berikut merupakan pendokumenan yang dijana oleh Modul:pendokumenan/functions/translit. [sunting]
- Pautan berguna: senarai sublaman • pautan • transklusi • kes ujian • kotak pasir
Modul ini akan mentransliterasi teks dalam Tulisan Meitei Mayek. Ia digunakan untuk mentransliterasi bahasa Manipuri and Manipur Kuno.
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:Mtei-translit/testcases.
Functions
[sunting]tr(text, lang, sc)- Transliterates a given piece of
textwritten 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 u = require("Module:string/char")
local tt = {
-- consonants
['ꯀ'] = 'kᵃ', ['ꯈ'] = 'khᵃ', ['ꯒ'] = 'gᵃ', ['ꯘ'] = 'ghᵃ', ['ꯉ'] = 'ngᵃ',
['ꯆ'] = 'cᵃ', ['ꫢ'] = 'chᵃ', ['ꯖ'] = 'jᵃ', ['ꯓ'] = 'jhᵃ', ['ꫣ'] = 'nyᵃ',
['ꫤ'] = 'ttᵃ', ['ꫥ'] = 'tthᵃ', ['ꫦ'] = 'ddᵃ', ['ꫧ'] = 'ddhᵃ', ['ꫨ'] = 'nnᵃ',
['ꯇ'] = 'tᵃ', ['ꯊ'] = 'thᵃ', ['ꯗ'] = 'dᵃ', ['ꯙ'] = 'dhᵃ', ['ꯅ'] = 'nᵃ',
['ꯄ'] = 'pᵃ', ['ꯐ'] = 'phᵃ', ['ꯕ'] = 'bᵃ', ['ꯚ'] = 'bhᵃ', ['ꯃ'] = 'mᵃ',
['ꯌ'] = 'yᵃ', ['ꯔ'] = 'rᵃ', ['ꯂ'] = 'lᵃ', ['ꯋ'] = 'wᵃ',
['ꫩ'] = 'shᵃ', ['ꫪ'] = 'ssᵃ', ['ꯁ'] = 'sᵃ', ['ꯍ'] = 'hᵃ',
-- finals
['ꯛ'] = 'k', ['ꯜ'] = 'l', ['ꯝ'] = 'm', ['ꯞ'] = 'p',
['ꯟ'] = 'n', ['ꯠ'] = 't', ['ꯡ'] = 'ng', ['ꯢ'] = 'i', -- ending
-- independent vowels
['ꯑ'] = 'ʼᵃ', ['ꯏ'] = 'ʼi', ['ꯎ'] = 'ʼu', ['ꫠ'] = 'ʼe', ['ꫡ'] = 'ʼo',
-- dependent vowels and diacritics
['ꯥ'] = 'ā', ['ꯤ'] = 'i', ['ꫫ'] = 'ī', ['ꯨ'] = 'u', ['ꫬ'] = 'ū',
['ꯦ'] = 'e', ['ꯩ'] = 'ei', ['ꫭ'] = 'āi',
['ꯣ'] = 'o', ['ꯧ'] = 'ou', ['ꫮ'] = 'au', ['ꫯ'] = 'āu',
['ꯪ'] = 'ṃ', ['ꫵ'] = 'ḥ', ['꫶'] = '¤',
-- marks
['꯫'] = '.', ['꫰'] = ',', ['꫱'] = '?', ['ꫳ'] = '˶', ['ꫴ'] = '˶˶', ['꯭'] = '͟',
-- numerals
["꯰"] = "0", ["꯱"] = "1", ["꯲"] = "2", ["꯳"] = "3", ["꯴"] = "4",
["꯵"] = "5", ["꯶"] = "6", ["꯷"] = "7", ["꯸"] = "8", ["꯹"] = "9",
-- zero-width space (display it if it's hidden in a word)
[u(0x200B)] = "‼",
-- zero-width non-joiner and joiner (display it if it's hidden in a word)
[u(0x200C)] = "₋",
[u(0x200D)] = "₊",
}
function export.tr(text, lang, sc)
if type(text) == 'table' then -- called directly from a template
text = text.args[1]
end
text = gsub(text, '.', tt)
text = gsub(text, 'ᵃ([aeiouāīū])', '%1')
text = gsub(text, 'ᵃ¤', '')
text = gsub(text, 'ᵃ͟', '͟')
text = gsub(text, 'ᵃ', 'a')
text = gsub(text, '¤', '')
return text
end
return export