יחידה:תרגום תוכן

מתוך ויקיפדיה, האנציקלופדיה החופשית

ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:תרגום תוכן/תיעוד

-- test, don't run me

local this = {}

function this.getCxUrl(frame)
	query = {}
	
	sourceTitle = frame.args['sourceTitle']
	if sourceTitle == nil
	then
		return 'חובה לתת שם דף מקור.'
	end
	
	query.page = sourceTitle
	
	targetTitle = frame.args['targetTitle']
	if (targetTitle ~= nil)
	then
		query.targettitle = targetTitle
	end
	
	query.to = 'he'
	query.from = frame.args['sourceLanguage'] or 'en'
	
	url = mw.uri.fullUrl('Special:CX', query)

	return url
end

function this.getCxLink(frame)
	url = this.getCxUrl(frame)
	
	sourceTitle = frame.args['sourceTitle']
	if sourceTitle == nil
	then
		return 'חובה לתת שם דף מקור.'
	end

	link = '[' .. tostring(url) .. ' תרגום ' .. frame.args['sourceTitle'] .. ']'
	
	return link
end

return this