Module:tkr-translit

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

This module will transliterate Tsakhur language text. 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:tkr-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 = mw.ustring.gsub
local u = require("Module:string utilities").char

local export = {}

function export.tr(text, lang, sc)

	if sc ~= "Cyrl" then
		return nil
	end

	-- Convert capital to lowercase palochka. Lowercase is found in tables.
	text = gsub(text, u(0x4C0), u(0x4CF))

	-- Digraphs with soft and hard sign.
	text = gsub(text, "()х()", "%1%2:")
	text = gsub(text, "", {
		="h",  ="H",
		="ʁ",  ="ʁ",
		="qӏ", ="Qӏ",
		="q:", ="Q:",
		="x",  ="X",
		="q",  ="Q",
	})

	-- Дж and гӏ digraphs.
	text = gsub(gsub(text, "дж", "ǯ"), "Дж", "Ǯ")
	text = gsub(gsub(text, "гӏ", "ɣ"), "Гӏ", "Ɣ")

	-- Geminate consonants.
	text = gsub(text, "", {
		="п:", ="П:",
		="т:", ="Т:",
		="ц:", ="Ц:",
		="ч:", ="Ч:",
		="к:", ="К:",
		="с:", ="С:",
		="х:", ="Х:",
	})

	-- General consonants.
	text = gsub(text, "", {
		="p",  ="P",
		="t",  ="T",
		="c",  ="C",
		="č",  ="Č",
		="k",  ="K",
		="s",  ="S",
		="š",  ="Š",
		="š:", ="Š:",
		="ꭓ",  ="Ꭓ",
		="n",  ="N",
		="l",  ="L",
		="d",  ="D",
		="z",  ="Z",
		="ž",  ="Ž",
		="g",  ="G",
		="ʔ",  ="ʔ",
		="b",  ="B",
		="f",  ="F",
		="m",  ="M",
		="r",  ="R",
		="v",  ="V",
	})

	-- Palatised consonants.
	text = gsub(text, "(ӏ?)(:?)()", function (con, gem, vow)
		return con .. "ʲ" .. gem .. (({ ="о", ="у", ="a" }) or vow)
	end)

	-- Rounded consonants.
	text = gsub(text, "(ӏ?:?)v", "%1ʷ")

	-- Iotated е.
	text = gsub(text, "%fе", "je")
	text = gsub(text, "%fЕ", "Je")

	-- Ejective consonants.
	text = gsub(text, "ӏ", {
		="ṗ", ="Ṗ",
		="ṭ", ="Ṭ",
		="c̣", ="C̣",
		="č̣", ="Č̣",
		="ḳ", ="Ḳ",
		="q̇", ="Q̇",
	})

	-- Umlaut vowels.
	text = gsub(text, "ь", {
		="ä", ="Ä",
		="ö", ="Ö",
		="ü", ="Ü",
	})

	-- Glottalised vowels.
	text = gsub(text, "()ӏ", "%1ˤ")

	-- Long и.
	text = gsub(gsub(text, "ий", "ī"), "Ий", "Ī")

	-- General vowels.
	text = gsub(text, "", {
		="j", ="J",
		="i", ="I",
		="e", ="E",
		="e", ="E",
		="a", ="A",
		="ɨ", ="Ɨ",
		="o", ="O",
		="u", ="U",
		="ju", ="Ju",
		="ja", ="Ja",
		="jo", ="Jo",
		="ʲ",
	})

	return text

end

return export