Module:Tfng-translit

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

This module will transliterate text in the Tifinagh script. It is used to transliterate Ghomara, Tarifit, Tashelhit, Tachawit, Central Atlas Tamazight, and Moroccan Amazigh. 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:Tfng-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 tt = {}

tt = {
	 = {
		 = "a",
		 = "b",
		 = "ḇ",
		 = "g",
		 = "g",
		 = "ǧ",
		 = "ǧ",
		 = "d",
		 = "ḏ",
		 = "ḍ",
		 = "ḏ̣",
		 = "e",
		 = "f",
		 = "k",
		 = "k",
		 = "k",
		 = "h", -- tmh, thv, taq, ttq, thz: "b"
		 = "h",
		 = "h",
		 = "ḥ",
		 = "ɛ",
		 = "x",
		 = "x",
		 = "q",
		 = "q",
		 = "i",
		 = "j",
		 = "j",
		 = "j",
		 = "l",
		 = "m",
		 = "n",
		 = "ny",
		 = "ng",
		 = "p",
		 = "u", -- tmh, thv, taq, ttq, thz: "w"
		 = "r",
		 = "ṛ",
		 = "ɣ",
		 = "ɣ",
		 = "j", -- thz: "ɣ"
		 = "s",
		 = "ṣ",
		 = "t",
		 = "ṯ",
		 = "c",
		 = "č",
		 = "ṭ",
		 = "v",
		 = "w",
		 = "y",
		 = "z",
		 = "z",
		 = "ẓ",
		 = "e",
		 = "o",
		 = "ʷ",
		 = ".",
		 = ""
	},
	 = { = "b",  = "w"},
	 = { = "b",  = "w"},
	 = { = "b",  = "w"},
	 = { = "b",  = "w"},
	 = { = "b",  = "w",  = "ɣ"}
}

function export.tr(text, lang, sc)
	if not sc then
		sc = require("Module:languages").getByCode(lang or "ber"):findBestScript(text):getCode()
	end

	if sc ~= "Tfng" then
		text = nil
	else
		if tt then
			text = mw.ustring.gsub(text, '.', tt)
		end
		text = mw.ustring.gsub(text, '.', tt)
	end

	return text
end

return export