Module:User:Benwing2/uk-translit

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

Language code in page name (User:Benwing2/uk) not recognized.


local export = {}
 
local rsubn = mw.ustring.gsub

-- version of rsubn() that discards all but the first return value
local function rsub(term, foo, bar)
	local retval = rsubn(term, foo, bar)
	return retval
end

local tt = {
	='A', ='a', ='B', ='b', ='V', ='v', ='H', ='h', 
	='G', ='g', ='D', ='d', ='E', ='e', ='Je', ='je', 
	='Ž', ='ž', ='Z', ='z', ='Y', ='y', ='I', ='i', 
	='Ji', ='ji', ='J', ='j', ='K', ='k', ='L', ='l', 
	='M', ='m', ='N', ='n', ='O', ='o', ='P', ='p', 
	='R', ='r', ='S', ='s', ='T', ='t', ='U', ='u', 
	='F', ='f', ='X', ='x', ='C', ='c', ='Č', ='č', 
	='Š', ='š', ='Šč', ='šč', ='ʹ', ='ʹ', ='Ju', ='ju', 
	='Ja', ='ja', 
	-- right single quotation mark, modifier letter apostrophe → modifier letter double prime
	='ʺ', = 'ʺ', 
	-- obsolete letters
	='Ë', ='ë', ='ʺ', ='ʺ', ='Y', ='y', ='Ě', ='ě', 
	='È', ='è',
	-- Ukrainian style quotes
	='“', ='”',
}

local AC = mw.ustring.char(0x0301) -- acute =  ́
local acute_decomposer = {
	 = "a" .. AC,
	 = "e" .. AC,
	 = "i" .. AC,
	 = "o" .. AC,
	 = "u" .. AC,
	 = "y" .. AC,
	 = "A" .. AC,
	 = "E" .. AC,
	 = "I" .. AC,
	 = "O" .. AC,
	 = "U" .. AC,
	 = "Y" .. AC,
}


function export.tr(text)--translit any words or phrases
	text = rsub(text, "'+", {  = 'ʺ' }) -- neutral apostrophe
	text = rsub(text, '.', tt)

	return text
end


function export.reverse_tr(text)--reverse-translit any words or phrases
	local reverse_tt = {}
	for k, v in pairs(tt) do
		reverse_tt = k
	end
	reverse_tt = "'"
	reverse_tt = "ь"
	reverse_tt = "и"
	reverse_tt = "И"
	text = rsub(text, '.', acute_decomposer)
	text = rsub(text, '', reverse_tt)
	text = rsub(text, 'č', reverse_tt)
	text = rsub(text, '.', reverse_tt)
	return text
end

return export