Mòdulu:lemma

Da Wikizziunariu, lu dizziunariu a cuntinutu lìbbiru.

La ducumintazzioni di stu mòdulu si pò criari nta Mòdulu:lemma/doc

local l = {}
local typ = require("Mòdulu:tipi di palori")
local lg = require("Mòdulu:lingui")

local ok_langs = {
	['fr'] = true,
	['de'] = true,
	['en'] = true,
	['eo'] = true,
	['es'] = true,
	['io'] = true,
	['it'] = true,
	['ru'] = true,
	['uk'] = true,
	['bg'] = true,
 	['ga'] = true, 
	['gallo'] = true,
 	['se'] = true, 
	['la'] = true, 
	['sl'] = true, 
	['cs'] = true, 
	['sv'] = true, 
	['nl'] = true, 
	['pt'] = true, 
	['fi'] = true
}
local not_ok_types = {
	['varianti pi limitazzioni tipugràfica'] = true,
	['nomu propriu'] = true,
	['nomu'] = true,
	['cugnomu'] = true,
	['nomu scintìficu'] = true,
	['nfissu'] = true,
	['ntirfissu'] = true,
	['prifissu'] = true,
	['suffixe'] = true,
	['circunfissu'] = true,
	['sìmmulu'] = true
}
function l.is_lemma(lang, type, forma, luc)
	if not lang then
		return false
	end
	if not ok_langs[lang] then
		return false
	end
	if forma then
		return false
	end
	if not type or not typ.is_type(type) or not_ok_types[typ.get_nomu(type)] then
		return false
	end
	if luc then
		return false
	end
	return true
end
function l.cat_lemma(lang, type, forma, luc)
	if lang == nil  or type == nil or forma == nil  or luc == nil then
		return ''
	end
	if l.is_lemma(lang, type, forma, luc) then
		nomu_lingua = lg.get_nomu(lang)
		if nomu_lingua then
			return  "Lemmi n " .. nomu_lingua
		else
			return ''
		end
	end
end
return l