ماڈیول:Citation/lang

آزاد انسائیکلوپیڈیا، وکیپیڈیا توں

Documentation for this module may be created at ماڈیول:Citation/lang/doc

--[[
returns the citation template name based on the {{{زبان}}} parameter
--]]
function p.is_rtl(frame)
	cite_type = frame.args['type'];							-- type of the citation template (book, web, etc.)
	lang = mw.ustring.lower(frame.args['lang'])				-- language code
	lang_code = getlangcode(lang)
	local rtl_langs = { ['fa'] =true, ['fa-IR'] =true, ['ar'] =true, ['ur'] =true, ['he'] =true, }
	if lang_code == "" or lang_code == nil or rtl_langs[lang_code] then
		if cite_type == "cite" then
			return types["cite_ur"]
		else
			return "یادکرد "..types[cite_type.."_ur"].."/هسته"
		end
	else
		if cite_type == "cite" then
			return types["cite_en"]
		else
			return "Cite "..types[cite_type.."_en"]
		end
	end
end
--[[
returns the citation template name based on the characters in title
--
function p.is_rtl2(frame)
	cite_type = frame.args['type'];							-- type of the citation template (book, web, etc.)
	Title = frame.args['title']
	if Title:match("[ابپتسجچحخدذرزژسشصضطظعغفقکگلمنوهی۱۲۳۴۵۶۷۸۹۰]+") then		--اگر کاراکترهای فارسی داشت
		if cite_type == "cite" then
			return types["cite_ur"]
		else
			return "یادکرد "..types[cite_type.."_ur"].."/هسته"
		end
	else
		if cite_type == "cite" then
			return types["cite_en"]
		else
			return "Cite "..types[cite_type.."_en"]
		end
	end
end
]]

return p