Module:udm-translit

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

This module will transliterate Udmurt language text per WT:UDM 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:udm-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 tab = {
	="A", ="B", ="V", ="G", ="D", ="E", ="O", ="Ž", ="Dž", ="Z", ="Dź", ="I", ="I", ="J",
	="K", ="L", ="M", ="N", ="O", ="Ö", ="P", ="R", ="S", ="T", ="U", ="F",
	="X", ="C", ="Ć", ="Č", ="Š", ="Šč", ="", ="Y", ="", ="E", ="U", ="A",
	='a', ='b', ='v', ='g', ='d', ='e', ='o', ='ž', ='dž', ='z', ='dź', ='i', ='i', ='j',
	='k', ='l', ='m', ='n', ='o', ='ö', ='p', ='r', ='s', ='t', ='u', ='f',
	='x', ='c', ='ć', ='č', ='š', ='šč', ='', ='y', ='', ='e', ='u', ='a', 
	-- Beserman
	='Å', ='å', ='W', ='w',
}

function export.tr(text, lang, sc)
	local language = lang
    -- Ё needs converting if is decomposed
    text = text:gsub("ё","ё"):gsub("Ё","Ё")
    
    -- soft consonants
    text = mw.ustring.gsub(text, "()()", "%1Q%2")
    if lang ~= "udm" then 
    	text = mw.ustring.gsub(text, "()()", "%1Q%2") 
    end

    -- soft vowels after a vowel or at the beginning of a word become j-
    text = mw.ustring.gsub(text, "(?)()", "%1j%2")
    text = mw.ustring.gsub(text, "^()", "J%1")
    text = mw.ustring.gsub(text, "^()", "j%1")
    
    -- palatalisation
    text = mw.ustring.gsub(text, "ДQ", "Ď")
    text = mw.ustring.gsub(text, "дQ", "ď")
    text = mw.ustring.gsub(text, "ЗQ", "Ź")
    text = mw.ustring.gsub(text, "зQ", "ź")
    text = mw.ustring.gsub(text, "ЛQ", "Ľ")
    text = mw.ustring.gsub(text, "лQ", "ľ")
    text = mw.ustring.gsub(text, "НQ", "Ń")
    text = mw.ustring.gsub(text, "нQ", "ń")
    text = mw.ustring.gsub(text, "СQ", "Ś")
    text = mw.ustring.gsub(text, "сQ", "ś")
    text = mw.ustring.gsub(text, "ТQ", "Ť")
    text = mw.ustring.gsub(text, "тQ", "ť")
    text = mw.ustring.gsub(text, "Q", "ʹ")
    
    return (mw.ustring.gsub(text,'.',tab))
end

return export