Module:Kali-translit

Hello, you have come here looking for the meaning of the word Module:Kali-translit. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:Kali-translit, but we will also tell you about its etymology, its characteristics and you will know how to say Module:Kali-translit in singular and plural. Everything you need to know about the word Module:Kali-translit you have here. The definition of the word Module:Kali-translit will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:Kali-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 Kayah Li script. It is used to transliterate Western Kayah. 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:Kali-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 = mw.ustring.char

local tt1 = {
	-- consonants
	 = 'k',  = 'hk',  = 'g',  = 'ng',
	 = 's',  = 'hs',  = 'z',  = 'ny',
	 = 't',  = 'ht',  = 'n',
	 = 'p',  = 'hp',  = 'm',
	 = 'd',  = 'b',
	 = 'r',  = 'y',  = 'l',  = 'w',
	 = 'th',  = 'h',  = 'v',  = 'c',
	-- vowels
	 = 'a',  = 'oe',  = 'i',  = 'o',
	-- tones
	 = u(0x0301),  = u(0x0300),  = u(0x0304),
	-- marks
	 = '-',  = '.',
	-- numerals
	 = '0',  = '1',  = '2',  = '3',  = '4',
	 = '5',  = '6',  = '7',  = '8',  = '9',
	-- zero-width space (display it if it hides in a word)
	 = '‼',
}

local tt2 = {
	-- vowels
	 = 'ue',  = 'ae',  = 'u',
	 = 'e',  = 'oa',
	 = 'oeue',  = 'ueae',  = 'oeu',
	 = 'oee',  = 'oeoa',
}

function export.tr(text, lang, sc)

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

	text = gsub(text, '(*)()', '%1’%2') -- add apostrophe between adjacent two vowels
	text = gsub(text, '()ꤟ(?)', '%1%2̤') -- change h between initial and vowel into subcolon

	text = gsub(text, 'ꤟꤌꤣ', 'u'..u(0x0324)..'eoe') -- use u() to break Unicode normalization
	text = gsub(text, 'ꤛꤣ', 'ueoe')
	text = gsub(text, '', tt2)
	text = gsub(text, '.', tt1)

	text = gsub(text, '()(*)̤', '%1̤%2') -- move subcolon to first aeiou
	text = gsub(text, '(̤?)(*)()', '%1%3%2') -- add tone mark on first aeiou

	return text
end
 
return export