Module:Talu-translit

Hello, you have come here looking for the meaning of the word Module:Talu-translit. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:Talu-translit, but we will also tell you about its etymology, its characteristics and you will know how to say Module:Talu-translit in singular and plural. Everything you need to know about the word Module:Talu-translit you have here. The definition of the word Module:Talu-translit will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:Talu-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 New Tai Lue script. It is used to transliterate . 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:Talu-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 tt = {
	-- consonants
	 = '˙ʼ',  = 'ʼ',
	 = 'k\204\135',  = 'x\204\135',  = 'n\204\135g',  = 'k',  = 'x',  = 'ng',
	 = 't\204\135s',  = 's\204\135',  = 'y\204\135',  = 'ts',  = 's',  = 'y',
	 = 't\204\135',  = 't\204\135h',  = 'n\204\135',  = 't',  = 'th',  = 'n',
	 = 'p\204\135',  = 'p\204\135h',  = 'm\204\135',  = 'p',  = 'ph',  = 'm',
	 = 'f\204\135',  = 'v\204\135',  = 'l\204\135',  = 'f',  = 'v',  = 'l',
	 = 'h\204\135',  = 'd\204\135',  = 'b\204\135',  = 'h',  = 'd',  = 'b',
	 = 'k\204\135w',  = 'x\204\135w',  = 'kw',  = 'xw',  = 's\204\135w',  = 'sw',
	-- vowels and finals (visual ordering by Unicode 8)
	 = '!',  = 'aa',  = 'ii',  = 'u',  = 'uu',  = 'oa',  = 'ue',
	 = 'e',  = 'ae',  = 'o',  = 'ay', -- this line to be swapped
	 = 'aay',  = 'uy',  = 'oy',  = 'oay',  = 'uey',  = 'iiy',
	 = 'w',  = 'ng',  = 'n',  = 'm',  = 'k',  = 'd',  = 'b',
	-- tones
	 = '¹',  = '²',
	-- numerals
	 = '0',  = '1',  = '2',  = '3',  = '4',
	 = '5',  = '6',  = '7',  = '8',  = '9',
	 = '1',
	-- ligatures ᧞ ᧟ sorted after ᦶᦜ
	 = 'l\204\135ae',  = 'l\204\135aew',
}

function export.tr(text, lang, sc)

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

	text = gsub(text, '()()', '%2%1') -- swapped
	text = gsub(text, '()()', '%1a%2')

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

	text = gsub(text, 'aa!', 'a')
	text = gsub(text, 'ii!', 'i')
	text = gsub(text, 'uu!', 'u')
	text = gsub(text, 'eii', 'oe')

	return text

end

return export