Module:Mtei-translit

Hello, you have come here looking for the meaning of the word Module:Mtei-translit. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:Mtei-translit, but we will also tell you about its etymology, its characteristics and you will know how to say Module:Mtei-translit in singular and plural. Everything you need to know about the word Module:Mtei-translit you have here. The definition of the word Module:Mtei-translit will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:Mtei-translit, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module will transliterate text in the Meitei Mayek script. It is used to transliterate Manipuri and Old Manipuri. 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

tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang.
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ᵃ',
	 = 'chᵃ',  = 'chhᵃ',  = '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
	 = 'aa',  = 'ee',  = 'ī',  = 'oo',  = 'ū',
	 = 'e',  = 'ei',  = 'āi',
	 = 'o',  = 'ou',  = 'au',  = 'āu',
	 = 'ng',  = 'ḥ',  = '¤',
	-- marks
	 = '.',  = ',',  = '?',  = '˶',  = '˶˶',  = '͟',
	-- numerals
	 = "0",  = "1",  = "2",  = "3",  = "4",
	 = "5",  = "6",  = "7",  = "8",  = "9",
	-- zero-width space (display it if it hides in a word)
	 = "‼",
	-- zero-width non-joiner and joiner (display it if it hides in a word)
	 = "₋",
	 = "₊",
}

function export.tr(text, lang, sc)

	if type(text) == 'table' then -- called directly from a template
		text = text.args
	end

	text = gsub(text, '.', tt)

	text = gsub(text, 'ᵃ()', '%1')
	text = gsub(text, 'ᵃ¤', '')
	text = gsub(text, 'ᵃ͟', '͟')
	text = gsub(text, 'ᵃ', 'a')
	text = gsub(text, '¤', '')
	
	return text

end

return export