Ugrás a tartalomhoz

Modul:R:Reverso

A Wikiszótárból, a nyitott szótárból

A modult a Modul:R:Reverso/doc lapon tudod dokumentálni

local export = {}
 
local chart = { 
['he']='hebrew',
['uk']='ukrainian',
['de']='german',
['ar']='arabic',
['en']='english',
['bg']='bulgarian',
['zh']='chinese',
['hr']='croatian',
['cs']='czech',
['da']='danish',
['nl']='dutch',
['fr']='french',
['el']='greek',
['hu']='hungarian',
['is']='icelandic',
['it']='italian',
['ja']='japanese',
['no']='norwegian',
['fa']='persian',
['pl']='polish',
['pt']='portuguese',
['ro']='romanian',
['ru']='russian',
['sk']='slovak',
['sl']='slovenian',
['es']='spanish',
['sv']='swedish',
['tr']='turkish'
}

function export.create(frame)
	local args = frame:getParent().args
	local title = mw.title.getCurrentTitle().text
	local title_url = mw.uri.encode(title, QUERY)
	local code1 = args[1]
	local code2 = args[2]

	local langFrom =  mw.ustring.gsub(code1,'..',chart)
	local langTo =  mw.ustring.gsub(code2,'..',chart)
	local link = ""
	if args == '' then
		link = "[https://context.reverso.net/ Reverso Context]"
	else
		link = "[https://context.reverso.net/translation/"..langFrom.."-"..langTo.."/"..title_url.." "..title.."] - ''Reverso''  (" ..args[1].."-"..args[2]..")"
	end
	return link
end
 
return export