Module:su-translit

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

This module will transliterate Sundanese language text per WT:SU TR. 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:su-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 consonants = {
	='k', ='g', ='ng', ='c', ='j', ='ny', 
	='t', ='d', ='n', ='p', ='b', ='m', 
	='y', ='r', ='l', ='w', ='s', ='h', 
	='f', ='q', ='v', ='x', ='z', ='kh', ='sy', 
}

local diacritics = {
	= 'i' , ='u' , ='é' , ='o' , ='e' , ='eu' , 
	='-a' ,  ='' , ='' , 
}

local special = {
	='m' , ='w' , ='y' , ='r' , ='l' ,
}

local nonconsonants = {
	-- vowels
	='a' , ='é' , ='i' , ='o' , ='u' , ='e' , ='eu' , ='reu' , ='leu' ,
	-- aditional characters
	='', -- digit pipe bar
	='ng',
	='r',
	='h',
	='k',
	='m',
	-- digits
	 = '0',  = '1',  = '2',  = '3',  = '4',
	 = '5',  = '6',  = '7',  = '8',  = '9',
}

-- translit any words or phrases
function export.tr(text, lang, sc)
	text = mw.ustring.gsub(
		text,
		'()'..
		'(?)' ..
		'(?)',
		function(c, s, d)
			if s == "" then
				if d == "" then
					return consonants .. 'a'
				else
					return consonants .. (diacritics or d)
				end
			else
				if d == "" then        
					return consonants .. (special or s) .. 'a'
				else
					return consonants .. (special or s) .. (diacritics or d)
				end
			end
		end)
	
	text = mw.ustring.gsub(text, '.', nonconsonants)
	
	return text
end
 
return export