Module:Linb-translit

Hello, you have come here looking for the meaning of the word Module:Linb-translit. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:Linb-translit, but we will also tell you about its etymology, its characteristics and you will know how to say Module:Linb-translit in singular and plural. Everything you need to know about the word Module:Linb-translit you have here. The definition of the word Module:Linb-translit will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:Linb-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 Linear B script. It is used to transliterate Mycenaean Greek. 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:Linb-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 chars = {
	 = "a",
	 = "e",
	 = "i",
	 = "o",
	 = "u",
	
	 = "da",
	 = "de",
	 = "di",
	 = "do",
	 = "du",
	
	 = "ja",
	 = "je",
	-- ji not in Unicode
	 = "jo",
	 = "ju",
	
	 = "ka",
	 = "ke",
	 = "ki",
	 = "ko",
	 = "ku",
	
	 = "ma",
	 = "me",
	 = "mi",
	 = "mo",
	 = "mu",
	
	 = "na",
	 = "ne",
	 = "ni",
	 = "no",
	 = "nu",
	
	 = "pa",
	 = "pe",
	 = "pi",
	 = "po",
	 = "pu",
	
	 = "qa",
	 = "qe",
	 = "qi",
	 = "qo",
	-- qu not in Unicode
	
	 = "ra",
	 = "re",
	 = "ri",
	 = "ro",
	 = "ru",
	
	 = "sa",
	 = "se",
	 = "si",
	 = "so",
	 = "su",
	
	 = "ta",
	 = "te",
	 = "ti",
	 = "to",
	 = "tu",
	
	 = "wa",
	 = "we",
	 = "wi",
	 = "wo",
	-- wu not in Unicode
	
	 = "za",
	 = "ze",
	-- zi not in Unicode
	 = "zo",
	-- zu not in Unicode
	
	 = "ha",
	 = "ai",
	 = "au",
	 = "dwe",
	 = "dwo",
	 = "nwo",
	 = "phu",
	 = "pte",
	 = "rya",
	 = "rai",
	 = "ryo",
	 = "tya",
	 = "twe",
	 = "two",
	
	 = "*18",
	 = "*19",
	 = "*22",
	 = "*34",
	 = "*47",
	 = "*49",
	 = "*56",
	 = "*63",
	 = "*64",
	 = "*79",
	 = "*82",
	 = "*83",
	 = "*86",
	 = "*89",
	
	-- explicit morpheme boundary
	 = "`",
}

function export.tr(text, lang, sc)
	local ret = {}
	local i = 1
	
	for c in string.gmatch(text, "*") do -- UTF-8 character pattern
		ret = chars or c
		i = i + 1
	end
	
	text = string.gsub(table.concat(ret, "-"), "%- %-", " ")
	text = string.gsub(text, "%-?`%-?", "-")
	
	return text
end

return export