Mòdul:ber-trans

De Viccionari
Icona de documentació de mòdul Documentació del mòdul[mostra] [modifica] [refresca]

A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]


Transliteració de l’alfabet tifinag (Tfng) usat per llengües amazigues (ber). Actualment operatiu per l’amazic marroquí (zgh).

local p = {}

local t2l_common = {
	["ⴰ"] = "a", -- IRCAM
	["ⴱ"] = "b", -- IRCAM
	["ⴲ"] = "b",
	["ⴳ"] = "g", -- IRCAM
	["ⴴ"] = "g",
	["ⴵ"] = "ǧ",
	["ⴶ"] = "ǧ",
	["ⴷ"] = "d", -- IRCAM
	["ⴸ"] = "d",
	["ⴹ"] = "ḍ", -- IRCAM
	["ⴺ"] = "ḍ",
	["ⴻ"] = "e", -- IRCAM
	["ⴼ"] = "f", -- IRCAM
	["ⴽ"] = "k", -- IRCAM
	["ⴾ"] = "k",
	["ⴿ"] = "k",
	["ⵀ"] = "h", -- IRCAM; tmh, thv, taq, ttq, thz: "b"
	["ⵁ"] = "h",
	["ⵂ"] = "h",
	["ⵃ"] = "ḥ", -- IRCAM
	["ⵄ"] = "ɛ", -- IRCAM
	["ⵅ"] = "x", -- IRCAM
	["ⵆ"] = "x",
	["ⵇ"] = "q", -- IRCAM
	["ⵈ"] = "q",
	["ⵉ"] = "i", -- IRCAM
	["ⵊ"] = "j", -- IRCAM
	["ⵋ"] = "j", -- Múrcia: ẓ̌
	["ⵌ"] = "j",
	["ⵍ"] = "l", -- IRCAM
	["ⵎ"] = "m", -- IRCAM
	["ⵏ"] = "n", -- IRCAM
	["ⵐ"] = "ny",
	["ⵑ"] = "ng",
	["ⵒ"] = "p", -- foreignisms
	["ⵓ"] = "u", -- IRCAM; tmh, thv, taq, ttq, thz: "w"
	["ⵔ"] = "r", -- IRCAM
	["ⵕ"] = "ṛ", -- IRCAM
	["ⵖ"] = "ɣ", -- IRCAM
	["ⵗ"] = "ɣ",
	["ⵘ"] = "j", -- thz: "ɣ"
	["ⵙ"] = "s", -- IRCAM
	["ⵚ"] = "ṣ", -- IRCAM
	["ⵛ"] = "c", -- IRCAM, enwiki: š
	["ⵜ"] = "t", -- IRCAM
	["ⵝ"] = "t",
	["ⵞ"] = "č",
	["ⵟ"] = "ṭ", -- IRCAM
	["ⵠ"] = "v", -- foreignisms
	["ⵡ"] = "w", -- IRCAM
	["ⵢ"] = "y", -- IRCAM
	["ⵣ"] = "z", -- IRCAM
	["ⵤ"] = "z",
	["ⵥ"] = "ẓ", -- IRCAM
	["ⵦ"] = "e",
	["ⵧ"] = "o",
	["ⵯ"] = "ʷ", -- IRCAM
	["⵰"] = ".",
	["⵿"] = "",
}

local t2l_alt = {
	["tmh"] = {
		["ⵀ"] = "b",
		["ⵓ"] = "w",
	},
	["thz"] = {
		["ⵀ"] = "b",
		["ⵓ"] = "w",
		["ⵘ"] = "ɣ",
	},
}
t2l_alt["thv"] = t2l_alt["tmh"]
t2l_alt["taq"] = t2l_alt["tmh"]
t2l_alt["ttq"] = t2l_alt["tmh"]

function p.tr(text, lang, sc)
	if not sc then
		sc = "Tfng"
	end
	
	if sc == "Arab" then
		-- perhaps will be implemented in the future
		text = nil
	elseif sc == "Latn" then
		-- no need to transliterate
		text = nil
	elseif sc == "Tfng" then
		if lang and t2l_alt[lang] then
			text = mw.ustring.gsub(text, '.', t2l_alt[lang])
		end
		text = mw.ustring.gsub(text, '.', t2l_common)
	end

	return text
end

return p