Module:huz-translit

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

This module will transliterate Hunzib language text per WT:HUZ 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:huz-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 u = require("Module:string/char")

local export = {}

local mapping1 = {
	 = "p",  = "b",
	 = "t",  = "d",
	 = "k",  = "g",
	 = "c",  = "č",
	 = "s",  = "z",  = "š",  = "ž",  = "x",
	 = "m",  = "n",
	 = "r",  = "l",
	 = "v",  = "y",
	 = "i",  = "e",  = "e",  = "a",  = "o",  = "u",  = "ɨ",  = "ə",
	 = "ī",  = "ā",  = "ō",  = "ū",  = "å",  = "ā̊",
	 = "ʾ",  = "̃",  = "̊",
}

local digraph = {
	 = "ṗ",  = "ṭ",  = "ḳ",  = "q̇",
	 = "c̣",  = "ƛ",  = "ƛ̣",  = "č̣",  = "q",
	 = "λ",  = "ǧ",  = "ḥ",  = "a̯",  = "h",
	 = "å̃",  = "ā̊̃",  = "ã",  = "ẽ",  = "ĩ",  = "õ",  = "ũ",  = "ɨ̃",  = "ə̃",
}

function export.tr(text, lang, sc)
	local str_gsub = string.gsub
	local UTF8_char = "*"
	
	-- Convert capital to lowercase palochka.
	text = str_gsub(text, u(0x4C0), u(0x4CF))
	
	for digraph, replacement in pairs(digraph) do
		text = str_gsub(text, digraph, replacement)
	end

	text = str_gsub(text, UTF8_char, mapping1)

	return text
end

return export