Module:udi-translit

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

This module will transliterate Udi language text per WT:UDI 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:udi-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", ="v", ="f", ="m", ="b",
	="d", ="t", ="c", ="z", ="s", ="n",
	="l", ="č", ="ž", ="š", ="r", ="g",
	="k", ="χ", ="j", ="i", ="u", ="e",
	="o", ="a", ="ə", ="gʲ",
	};

local trigraphs = {
	 = 'ǯ:',
	 = 'ǯ:',
	 = 'č̣:',
}
local digraphs = {
	 = 'ṗ',
	 = 'ṭ',
	 = 'ʒ',
	 = 'c̣',
	 = 'ǯ',
	 = 'č̣',
	 = 'č:',
	 = 'ž:',
	 = 'ž:',
	 = 'š:',
	 = 'š:',
	 = 'ḳ',
	 = 'ɣ',
	 = 'q̇',
	 = 'q',
	 = 'h',
	 = 'ü',
	 = 'ö',
	 = 'ä',
	 = 'i̱',
	 = 'i̱',
	 = 'u̱',
	 = 'u̱',
	 = 'e̱',
	 = 'e̱',
	 = 'o̱',
	 = 'o̱',
	 = 'a̱',
	 = 'a̱',
	 = 'ə̱',
}

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

return export