Mòdul:llengua: diferència entre les revisions

Contingut suprimit Contingut afegit
valors per defecte
nom apostrofat
Línia 5:
["ps-Arab"]=true, ["ug-Arab"]=true, ["ur-Arab"]=true, ["Avst"]=true, ["Hebr"]=true,
["Nkoo"]=true, ["Phli"]=true, ["Phnx"]=true, ["Syrc"]=true, ["Thaa"]=true}
local apostrofa = {
["hawa"]=false, ["hind"]=false, -- h consonant hawaià, hindi
["hia"]=false, ["hie"]=false, ["hio"]=false, ["hui"]=false, -- vocal consonant
["uix"]=true, -- excepció per u vocal
["ha"]=true, ["he"]=true, ["hi"]=true, ["ho"]=true, ["hu"]=true, ["hy"]=true, -- excepte anteriors
["ia"]=false, ["ià"]=false, ["ie"]=false, ["io"]=false, ["iu"]=false, -- i consonant
["ua"]=false, ["ue"]=false, ["ui"]=false, ["uí"]=false, ["uï"]=false, ["uo"]=false, -- u consonant
["ya"]=false, ["ye"]=false, ["yi"]=false, ["yo"]=false, ["yu"]=false, -- y consonant
["a"]=true, ["à"]=true, ["e"]=true, ["è"]=true, ["é"]=true,
["i"]=true, ["í"]=true, ["ï"]=true, ["y"]=true,
["o"]=true, ["ò"]=true, ["ó"]=true, ["u"]=true, ["ú"]=true, ["ü"]=true -- excepte anteriors
}
 
-- Cerca el nom de llengua definit a /taula o en la llibreria de MediaWiki
Linha 56 ⟶ 68:
end
 
function llengua.del_nom(frame)
local codi = frame.args[1]
local nom = nom(codi)
local ap = apostrofa(nom)
if ap then
return "de l'" .. nom
end
return "del " .. nom
end
 
function llengua.al_nom(frame)
local codi = frame.args[1]
local nom = nom(codi)
local ap = apostrofa(nom)
if ap then
return "a l'" .. nom
end
return "al " .. nom
end
 
function apostofa(text)
for i=4,1,-1 do
inicials = mw.ustring.sub(text, 1, i)
apo = apostrofa[inicials]
if apo ~= nil then
return apo
end
end
return false
end
return llengua