Module:lez-translit

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

This module will transliterate Lezgi language text per WT:LEZ 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:lez-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 gsub = string.gsub
local u = require("Module:string utilities").char

local export = {}

local tt = {
	="b", ="p", ="f", ="v", ="m",
	="d", ="t", ="j", ="n", ="z", ="c",
	="s", ="ž", ="š", ="šč", 
	="l", ="č", ="r", ="g", ="k", ="χ", 
	="ʾ", ="a", ="e", ="y", ="i", ="o", ="u", 
	="ë", ="’", ="è", ="ju", ="ä",
	="B", ="P", ="F", ="V", ="M",
	="D", ="T", ="J", ="N", ="Z", ="C",
	="S", ="Ž", ="Š", ="Šč", 
	="L", ="Č", ="R", ="G", ="K", ="Χ", 
	="ʾ", ="A", ="E", ="Y", ="I", ="O", ="U", 
	="Ë", ="’", ="È", ="Ju", ="Ä"};

local trigraphs = {
	 = 'q°',
	 = 'Q°',
	 = 'q̄°',
	 = 'Q̄°',
	 = 'q̇°',
	 = 'Q̇°',
	 = 'ġ°',
	 = 'Ġ°',
	 = 't̄°',
	 = 't̄°',
	 = 'c̄°',
	 = 'C̄°',
	 = 'k̄°',
	 = 'K̄°',
	 = 'ṭ°',
	 = 'Ṭ°',
	 = 'c̣°',
	 = 'C̣°',
	 = 'ḳ°',
	 = 'Ḳ°',
}

local digraphs = {
	 = 't°',
	 = 'T°',
	 = 'z°',
	 = 'Z°',
	 = 'χ°',
	 = 'Χ°',
	 = 'c°',
	 = 'C°',
	 = 's°',
	 = 'S°',
	 = 'p̄',
	 = 'ṗ',
	 = 't̄', 
	 = 'P̄',
	 = 'Ṗ',
	 = 'T̄',
	 = 'c̣',
	 = 'c̄',
	 = 'ṭ',
	 = 'č̄',
	 = 'č̣',
	 = 'q̇',
	 = 'k̄',
	 = 'ḳ',
	 = 'q',
	 = 'q̄',
	 = 'ġ',
	 = 'h',
	 = 'C̣',
	 = 'C̄',
	 = 'Ṭ',
	 = 'Č̄',
	 = 'Č̣',
	 = 'Q̇',
	 = 'K̄',
	 = 'Ḳ',
	 = 'Q',
	 = 'Q̄',
	 = 'Ġ',
	 = 'H',
	 = 'ü',
	 = 'Ü',
	 = 'x',
	 = 'X',
	 = 'g°',
	 = 'G°',
	 = 'k°',
	 = 'K°',
}

function export.tr(text, lang, sc)
	-- Convert capital to lowercase palochka. Lowercase is found in tables
	-- above.
	text = gsub(text, u(0x4C0), u(0x4CF))
	
	for digraph, replacement in pairs(digraphs) do
		text = gsub(text, digraph, replacement)
	end
	
	for trigraph, replacement in pairs(trigraphs) do
		text = gsub(text, trigraph, replacement)
	end
	
	text = gsub(text, ".*", tt)
	
	return text
end

return export