پرش به محتوا

پودمان:Header/attribution data

از سورسکال

توضیحات این پودمان می‌تواند در پودمان:Header/attribution data/توضیحات قرار گیرد.

-- Persian (fa.wikisource) localization of the English contributor-types
-- config module. Field names (noun, prefix, param_name, special_cases,
-- language_prefix, index) are unchanged, since another module reads this
-- table by these keys - only the user-facing strings were translated.
-- param_name values were kept in Latin script so existing-style template
-- calls (e.g. |author=, |translator=) keep working.

require('strict')

local function anon(text)
	text = text or 'ناشناس'
	local cat = ''
	if mw.title.getCurrentTitle():inNamespaces(0, 114) then
		cat = '[[رده:' .. 'آثار نویسندگان ناشناس' .. ']]'
	end
	return '[[درگاه:متون ناشناس|' .. text .. ']]' .. cat
end

local function anon_nocat(text)
	return '[[درگاه:متون ناشناس|' .. (text or 'ناشناس') .. ']]'
end

local contrib_types = {
	{noun = 'نویسنده', prefix = 'اثر', param_name = 'author'},
	{noun = 'منسوب به', prefix = 'منسوب به', param_name = 'attributed-to', special_cases = {}},
	{noun = 'اقتباس‌کننده', prefix = 'اقتباس از', param_name = 'adapter'},
	{noun = 'خلاصه‌کننده', prefix = 'خلاصه از', param_name = 'abridger'},
	{noun = 'تصویرگر', prefix = 'تصویرگری از', param_name = 'illustrator'},
	{noun = 'کارگردان', prefix = 'کارگردانی از', param_name = 'director'},
	{noun = 'ترانه‌سرا', prefix = 'ترانه از', param_name = 'lyricist'},
	{noun = 'لیبرتونویس', prefix = 'لیبرتو از', param_name = 'librettist'},
	{
		noun = 'کتاب از',
		prefix = 'کتاب از',
		param_name = 'book-by',
		special_cases = {
			['?'] = 'نویسنده نامعلوم',
			['unknown'] = 'نویسنده نامعلوم',
			['not mentioned'] = 'نویسنده نامعلوم',
			['anon'] = anon,
			['anonymous'] = anon,
			['various'] = 'نویسنده‌های مختلف'
		}
	},
	{noun = 'آهنگساز', prefix = 'آهنگسازی از', param_name = 'composer'},
	{noun = 'تنظیم‌کننده', prefix = 'تنظیم از', param_name = 'arranger'},
	{
		noun = 'مترجم',
		prefix = 'ترجمهٔ',
		param_name = 'translator',
		language_prefix = function(language_name)
			return 'ترجمه‌شده از ' .. language_name .. ' توسط'
		end,
		special_cases = {
			['?'] = 'مترجم نامعلوم',
			['unknown'] = 'مترجم نامعلوم',
			['not mentioned'] = 'مترجم نامعلوم',
			['anon'] = anon,
			['anonymous'] = anon,
			['various'] = 'مترجم‌های مختلف',
			['wikisource'] = '[[:en:Wikisource:Translations|ویکی‌نبشتهٔ انگلیسی]]'
		}
	},
	{
		noun = 'ویراستار',
		prefix = 'تصحیح',
		param_name = 'editor',
		special_cases = {
			['?'] = 'ویراستار نامعلوم',
			['unknown'] = 'ویراستار نامعلوم',
			['not mentioned'] = 'ویراستار نامعلوم',
			['anon'] = anon_nocat,
			['anonymous'] = anon_nocat,
			['various'] = 'ویراستار‌های مختلف'
		}
	},
	{noun = 'گردآورنده', prefix = 'گردآوری از', param_name = 'compiler'}
}

for i = 1, #contrib_types do
	local noun = contrib_types[i]['noun']
	contrib_types[i]['param_name'] = contrib_types[i]['param_name'] or string.gsub(noun, ' ', '-')
	contrib_types[i]['special_cases'] = contrib_types[i]['special_cases'] or {
		['?'] = noun .. ' نامعلوم',
		['unknown'] = noun .. ' نامعلوم',
		['not mentioned'] = noun .. ' نامعلوم',
		['anon'] = anon,
		['anonymous'] = anon,
		['various'] = noun .. '‌های مختلف'
	}
	contrib_types[i]['index'] = i
end

return contrib_types