Mòdul:Hy-trans
Aparença
Documentació del mòdul [ mostra ] [ modifica el codi ] [ mostra l'historial ] [ refresca ]
A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]
Transcripció de l'armeni al català segons els criteris de Viquipèdia:Transcripció de l'armeni. Actualment s'usa com a eina de consulta, vegeu Viquipèdia:Transcripció de l'armeni#Consulta.
local p = {}
local trans2ca = require("Module:ca-trans")
local u = mw.ustring.char
local GR = u(0x0300) -- grave = ̀
local AC = u(0x0301) -- acute = ˊ
local DI = u(0x0308) -- diaeresis = ¨
local tt = {
["ա"]="a", ["բ"]="b", ["գ"]="g", ["դ"]="d", ["ե"]="e", ["զ"]="z", ["է"]="e", ["ը"]="e",
["թ"]="t", ["ժ"]="j", ["ի"]="i", ["լ"]="l", ["խ"]="kh", ["ծ"]="ts", ["կ"]="k", ["հ"]="h",
["ձ"]="dz", ["ղ"]="gh", ["ճ"]="tx", ["մ"]="m", ["յ"]="i", ["ն"]="n", ["շ"]="x", ["ո"]="o",
["չ"]="tx", ["պ"]="p", ["ջ"]="dj", ["ռ"]="r", ["ս"]="s", ["վ"]="v", ["տ"]="t", ["ր"]="r",
["ց"]="tx", ["ւ"]="v", ["փ"]="p", ["ք"]="k", ["օ"]="o", ["ֆ"]="f", ["և"]="ev",
["Ա"]="A", ["Բ"]="B", ["Գ"]="G", ["Դ"]="D", ["Ե"]="E", ["Զ"]="Z", ["Է"]="E", ["Ը"]="E",
["Թ"]="T", ["Ժ"]="J", ["Ի"]="I", ["Լ"]="L", ["Խ"]="Kh", ["Ծ"]="Ts", ["Կ"]="K", ["Հ"]="H",
["Ձ"]="Dz", ["Ղ"]="Gh", ["Ճ"]="Tx", ["Մ"]="M", ["Յ"]="I", ["Ն"]="N", ["Շ"]="X", ["Ո"]="O",
["Չ"]="Tx", ["Պ"]="P", ["Ջ"]="Dj", ["Ռ"]="R", ["Ս"]="S", ["Վ"]="V", ["Տ"]="T", ["Ր"]="R",
["Ց"]="Tx", ["Ւ"]="V", ["Փ"]="P", ["Ք"]="K", ["Օ"]="O", ["Ֆ"]="F"
}
local function wtr(armn)
-- digraphs
armn = mw.ustring.gsub(armn, "([ոՈ])ւ", {["ո"]="u", ["Ո"]="U"})
-- changes at the beginning of a word
armn = mw.ustring.gsub(armn, "^([եԵ])", {["ե"]="ie", ["Ե"]="Ie"})
armn = mw.ustring.gsub(armn, "^և", "iev")
armn = mw.ustring.gsub(armn, "^([ոՈ])", {["ո"]="vո", ["Ո"]="Vո"})
local latin = mw.ustring.gsub(armn, '.', tt)
if not mw.ustring.find(latin, "[" .. AC .. GR .. "]") then
-- accent en la darrera síl·laba excepte monosíl·labs
local sil = mw.text.split(trans2ca.sil(latin), "·")
if #sil > 1 then
if string.find(sil[#sil], "[AEOaeo]") then
sil[#sil] = mw.ustring.gsub(sil[#sil], "[AEOaeo]", "%1" .. AC, 1) -- vocal forta en diftongs decreixents o creixents
else
sil[#sil] = mw.ustring.gsub(sil[#sil], "[IUiu]", "%1" .. AC, 1) -- primera vocal dèbil en diftongs creixents
end
latin = table.concat(sil)
end
end
latin = trans2ca.accents(latin) -- regles d'accentuació
local char_acc = {["A"..AC]="À", ["E"..AC]="È", ["I"..AC]="Í", ["O"..AC]="Ó", ["U"..AC]="Ú",
["a"..AC]="à", ["e"..AC]="è", ["i"..AC]="í", ["i"..DI]="ï", ["o"..AC]="ó", ["u"..AC]="ú", ["u"..DI]="ü"}
latin = mw.ustring.gsub(latin, ".[" .. AC .. DI .. "]", char_acc)
-- correcció ò
if mw.ustring.find(armn, "[ոՈ][^աեէըիյօև]+$") then -- darrera vocal ò
latin = mw.ustring.gsub(latin, "([óÓ])", {["ó"]="ò", ["Ó"]="Ò"})
end
-- correcció gue/gui
latin = mw.ustring.gsub(latin, "([Gg])([eèií])", "%1u%2")
-- correcció intervocàlica ss, ix
latin = mw.ustring.gsub(latin, "([AEIOUaeiouÀÈÍÓÒÚàèíóòú])s([aeiouàèíóòú])", "%1ss%2")
latin = mw.ustring.gsub(latin, "([AEOUaeouÀÈÓÒÚàèóòúü])x", "%1ix")
return latin
end
-- Transliterates text, a single word or phrase.
function p.tr(text)
if type(text) == "table" then text = text.args[1] end
local trwords = {}
for word in mw.text.gsplit(text, '%s') do
table.insert(trwords, wtr(word))
end
return table.concat(trwords, ' ')
end
return p