Module:Translation license

--[=[ Implements Template:Translation license ]=]

local p = {} --p stands for package

local getArgs = require('Module:Arguments').getArgs local yesno = require('Module:Yesno')

local license_scope = require('Module:License_scope')._license_scope local categoryHandler = require('Module:Category handler').main

local namespace = mw.title.getCurrentTitle.nsText

function p._license_collapsible_container(args) -- license table local license_rows = {} for k = 1, #args, 2 do		local header = args[k] or '' local license = args[k + 1] or '' license_rows[(k + 1)/2] = ' ' .. header .. ' ' .. license .. ' '	end local tag_table = ' ' -- license container local frame = mw.getCurrentFrame local container_begin = frame:expandTemplate { ['title'] = 'License container begin', ['args'] = { ['images'] = args.images, ['message'] = args.message }	}	local container_end = frame:expandTemplate { ['title'] = 'License container end' }	return container_begin .. tag_table .. container_end end

function p.license_collapsible_container(frame) return p._license_collapsible_container(getArgs(frame)) end

function p._no_license(args) local scope = args.scope or 'content' local category = args.category or '' local text = " '''This page does not provide license information for the " .. scope .. ".''' Pages with no license information may be nominated for deletion. If you'd like to help, see Help:Copyright tags or comment. " .. category local frame = mw.getCurrentFrame return frame:expandTemplate { ['title'] = 'license', ['args'] = { ['image'] = 'Ambox_warning_pn.svg', ['class'] = 'warningLicenseContainer', ['text'] = text }	} end

function p.no_license(frame) return p._no_license(getArgs(frame)) end

function p._translation_license(args) local frame = mw.getCurrentFrame local original = args.original local translation = args.translation local trans_ns = namespace == "Translation" or namespace == "Translation talk" if not translation and trans_ns then translation = frame:expandTemplate { ['title'] = 'GFDL/CC-BY-SA-4.0' }	end -- images in title local images if not (original and translation) then images = '' end -- text in title local message = args.message if not message then message = license_scope .. " a translation and has a separate copyright status " if namespace == "Author" or namespace == "Author talk" then message = message .. "to some or all of the original content attributed to this author." elseif namespace == "File" or namespace == "File talk" then message = message .. "to the applicable copyright protections of the originating source." else message = message .. "to the applicable copyright protections of the original content." end end -- license tags if not original then original = p._no_license({			['scope'] = 'original content',			['cateogry'] = categoryHandler{				['main'] = ,				['author'] = ,				['file'] = '',   		}		}) end if not translation then local category local noCatNamespaces = { ['Help'] = true, ['Help talk'] = true, ['Template'] = true, ['Template talk'] = true, ['Wikisource'] = true, ['Wikisource talk'] = true, ['Category'] = true, ['Category talk'] = true, ['Module'] = true, ['Module talk'] = true }		if not noCatNamespaces[namespace] then category = '' end translation = p._no_license({			['scope'] = 'translation',			['category'] = category		}) end return p._license_collapsible_container({		['images'] = images,		['message'] = message,		[1] = 'Original:',		[2] = original,		[3] = 'Translation:',		[4] = translation	}) end

function p.translation_license(frame) return p._translation_license(getArgs(frame)) end

return p