ماڊيول:Wikidata/تتبع

کليل ڄاڻ چيڪلي، وڪيپيڊيا مان

Documentation for this module may be created at ماڊيول:Wikidata/تتبع/doc

local p = {}

function trim(s)
		--Removes leading zeroes from value
		if s:sub(1,1)=="P" then return s:sub(2)
		else return s
		end
	end
local function category(propertyid,q,nocate)
        main = '[[زمرو:صفحا ساڻ وڪي ڊيٽا|'.. trim(propertyid) ..']]'
	if nocate and nocate  ~= ''  
		then -- to hide the category
	 		return ''
	 	elseif q and q  ~= ''  
		then 
	 		return q..''..main 
	end
	d = mw.text.trim(propertyid)
	s = list(d)
	if s then
		return '[[زمرو:'.. s ..']]'..main  -- linktext(s)
	end
end

local function icons(u,id,noicon,icon2)
	if noicon and noicon  ~= ''  
		then -- to hide the icon
	 		return ''
	end
	local label = mw.wikibase.label(u) --{{#invoke:Wikibase|label| u }}
		if label ==nil or not label 
			then label ='' 
			else
		end

	local temp =  label .. ' ('.. u ..')'
	local ico =  'Arbcom_ru_editing.svg|13px'
		if icon2 and icon2 ~='' then 
			ico = 'Wikidata-logo.svg|20px' 
			size = '20px' 
			end
	local so = 'خاصيت جي حالت تبديل ڪريو ' .. temp ..' وڪي ڊيٽا تي'
	local im =' [[File:'.. ico .. '|baseline|link=d:'.. (id or '') .. '#'.. u ..'|'.. so .. ']]'
	local noprint=  '<span class="noprint">'.. im ..'</span>'
	local sup=  '<sup>'.. noprint ..'</sup>'
	if u then
		return noprint
	end
end

local function xt(e)
		return  'صفحا ساڻ خاصيت '.. e
end

local function wd(e)
		return e .. ' وڪي ڊيٽا مان اخذ ٿيل'
end


function list(s)

	local I = trim(s)
        if I == '6' 	then ab = 'سربراه حڪومت'
	elseif I =='7'	then ab ='ڀاءُ'
	elseif I =='3373'	then ab ='ڀاءُ ۽ ڀيڻ'
	elseif I =='9'	then ab ='ڀيڻ'
	elseif I =='17'	then ab ='ملڪ'
	elseif I =='474'	then ab ='ملڪي ڊائلنگ ڪوڊ'
	elseif I =='18'	then ab ='تصوير'
	elseif I =='19'	then ab ='مقام ڄم'
	elseif I =='20'	then ab ='مقام موت'
	elseif I =='22'	then ab ='پيءُ'
	elseif I =='25'	then ab ='ماءُ'
	elseif I =='26'	then ab ='زندگي ڀائيوار'
	elseif I =='27'	then ab ='شهريت'
	elseif I =='35'	then ab ='سربراه رياست'
	elseif I =='36'	then ab ='دارالحڪومت'
	elseif I =='37'	then ab ='سرڪاري ٻولي'
	elseif I =='38'	then ab ='رائج سڪو'
	elseif I =='39'	then ab ='منصب'
	elseif I =='40'	then ab ='ٻار'
	elseif I =='41'	then ab ='جهنڊو'
	elseif I =='50'	then ab ='ليکڪ'
	elseif I =='53'	then ab ='خاندان'
	elseif I =='54'	then ab ='رڪن اسپورٽ ٽيم'
	elseif I =='57'	then ab ='ڊائريڪٽر'
	elseif I =='58'	then ab ='اسڪرين ليکڪ'
	elseif I =='61'	then ab ='موجد'
	elseif I =='66'	then ab ='آبائی علاقو يا شهر'
	elseif I =='69'	then ab ='مادر علمي'
	elseif I =='84'	then ab ='معمار'
	elseif I =='86'	then ab ='ڪمپوزر'
	elseif I =='94'	then ab ='قومي نشان جي تصوير'
	elseif I =='98'	then ab ='ايڊيٽر'
	elseif I =='101'	then ab ='دلچسپي'
	elseif I =='102'	then ab ='جماعت'
	elseif I =='106'	then ab ='پیشو'
	elseif I =='108'	then ab ='نوڪري'
	elseif I =='109'	then ab ='دستخط'
	elseif I =='112'	then ab ='باني'
	elseif I =='115'	then ab ='ملعب'
	elseif I =='119'	then ab ='مقام دفن'
	elseif I =='123'	then ab ='ناشر'
	elseif I =='127'	then ab ='مالڪ'
	elseif I =='131'	then ab ='انتظامي ڀاڱو'
	elseif I =='135'	then ab ='تحريڪ'
	elseif I =='136'	then ab ='صنف'
	elseif I =='137'	then ab ='مشغل'
	elseif I =='138'	then ab ='نالو سبب'
	elseif I =='140'	then ab ='مذهب'
	elseif I =='141'	then ab ='سانڍڻ حالت'
	elseif I =='144'	then ab ='اصل ڪم'
	elseif I =='154'	then ab ='نعرو'
	elseif I =='155'	then ab ='اڳوڻڪو'
	elseif I =='156'	then ab ='ايندڙ'
	elseif I =='157'	then ab ='قاتل'
	elseif I =='158'	then ab ='ختم'
	elseif I =='159'	then ab ='صدر مقام'
	elseif I =='162'	then ab ='پيش ڪندڙ'
	elseif I =='166'	then ab ='اعزاز'
	elseif I =='169'	then ab ='انتظامي هدايتڪار'
	elseif I =='170'	then ab ='ايجاد ڪندڙ'
	elseif I =='172'	then ab ='نسل'
	elseif I =='178'	then ab ='ترقي ڏيندڙ'
	elseif I =='78'	then ab ='انٽرنيٽ ڪوڊ'
	elseif I =='179'	then ab ='سلسليوار'
	elseif I =='181'	then ab ='ڇڪيل نقشو'
	elseif I =='184'	then ab ='پي ايڇ ڊي جي نگراني'
	elseif I =='185'	then ab ='پي ايڇ ڊي جا شاگرد'
	elseif I =='218'	then ab ='آءِايس او ڪوڊ 639-1'
	elseif I =='219'	then ab ='آءِايس او ڪوڊ 3166-2'
	elseif I =='219'	then ab ='آءِايس او ڪوڊ 639-2'
	elseif I =='220'	then ab ='آءِايس او ڪوڊ 639-3'
	elseif I =='221'	then ab ='آءِايس او ڪوڊ 639-6'
	elseif I =='225'	then ab ='سائنسي لقب'
	elseif I =='238'	then ab ='IATA ڪوڊ'
	elseif I =='239'	then ab ='آءِ سي اي او ڪوڊ'
	elseif I =='241'	then ab ='فوجي شاخ'
	elseif I =='242'	then ab ='نقشو'
	elseif I =='243'	then ab ='او سي ايل سي عدد'
	elseif I =='249'	then ab ='اسٽاڪ ايڪسچينج تي هڪ ڪمپني جو ڪوڊ'
	elseif I =='263'	then ab ='سرڪاري رهائش'
	elseif I =='264'	then ab ='ريڪارڊنگ ڪمپني'
	elseif I =='272'	then ab ='اسٽوڊيو'
	elseif I =='274'	then ab ='ماليڪيولر فارمولو'
	elseif I =='275'	then ab ='اِجازت نامو'
	elseif I =='277'	then ab ='پروگرامنگ ٻولي'
	elseif I =='279'	then ab ='ذيلي قسم'
	elseif I =='281'	then ab ='ڊاڪ ڪوڊ'
	elseif I =='286'	then ab ='سيکاريندڙ'
	elseif I =='287'	then ab ='نموني ساز'
	elseif I =='297'	then ab ='آءِايس او ڪوڊ 3166-1'
	elseif I =='300'	then ab ='آءِايس او ڪوڊ 3166-2'
	elseif I =='306'	then ab ='آپريٽنگ سسٽم'
	elseif I =='345'	then ab ='imdb ڳنڍڻو'
	elseif I =='355'	then ab ='ڳانڍاپو'
	elseif I =='364'	then ab ='ٻولي'
	elseif I =='373'	then ab ='سانچو درجابندي ڪامنز پلڪار'
	elseif I =='404'	then ab ='راند جو انداز'
	elseif I =='405'	then ab ='سائنسي نامزد'
	elseif I =='408'	then ab ='انجڻ'
	elseif I =='421'	then ab ='وقت پٽو'
	elseif I =='410'	then ab ='فوجي رتبو'
	elseif I =='412'	then ab ='آڊيو پرت'
	elseif I =='413'	then ab ='مرڪز وڄائيندڙ'
	elseif I =='414'	then ab ='منڊي'
	elseif I =='425'	then ab ='ڪرت شعبو'
	elseif I =='428'	then ab ='مختصر پلانٽ ورلڊ'
	elseif I =='449'	then ab ='نشريات نيٽ ورڪ'
	elseif I =='452'	then ab ='صنعت ساز ڪمپني'
	elseif I =='463'	then ab ='رڪن'
	elseif I =='473'	then ab ='فون نمبر'
	elseif I =='493'	then ab ='ڪوڊ ICD9'
	elseif I =='494'	then ab ='ڪوڊ ICD10'
	elseif I =='495'	then ab ='اصل ملڪ'
	elseif I =='498'	then ab ='آءِايس او ڪوڊ 4217'
	elseif I =='509'	then ab ='وجه موت'
	elseif I =='598'	then ab ='قيادات شخص'
	elseif I =='511'	then ab ='سابقه شرف دہنده'
	--elseif I =='516'	then ab ='محرك'
	elseif I =='1035'	then ab ='لاحقه شرف دهنه'
	elseif I =='512'	then ab ='تعليمي سند'
	elseif I =='527'	then ab ='مكونات'
	elseif I =='551'	then ab ='رهائش'
	elseif I =='555'	then ab ='سجل الفوز زوجي'
	elseif I =='562'	then ab ='مصرف'
	elseif I =='563'	then ab ='ڪوڊ ICDO'
	elseif I =='564'	then ab ='سجل الفوز فردي'
	elseif I =='569'	then ab ='تاريخ ڄم'
	elseif I =='570'	then ab ='تاريخ موت'
	elseif I =='571'	then ab ='تاريخ تاسيس'
	elseif I =='574'	then ab ='تاريخ وضع تسمية علمية'
	elseif I =='575'	then ab ='تاريخ دريافت'
	elseif I =='576'	then ab ='تاريخ اختتام'
	elseif I =='577'	then ab ='تاريخ اشاعت'
	elseif I =='580'	then ab ='تاريخ آغاز'
	elseif I =='582'	then ab ='تاريخ انتها'
	elseif I =='585'	then ab ='تاريخ'
	elseif I =='607'	then ab ='لڙائيون'
	elseif I =='610'	then ab ='أعلى قمة'
	elseif I =='625'	then ab ='متناسقات'
	elseif I =='634'	then ab ='ڪپتان'
	elseif I =='641'	then ab ='راند'
	elseif I =='646'	then ab ='قالب فريبيس يستخدم بيانات'
	elseif I =='737'	then ab ='مؤثر شخصيتون'
	elseif I =='746'	then ab ='تاريخ الاختفاء'
	elseif I =='748'	then ab ='معين'
	elseif I =='2130'	then ab ='میزانيه'
	elseif I =='749'	then ab ='شركة أم'
	elseif I =='750'	then ab ='تقسیم کنندہ'
	elseif I =='757'	then ab ='معرف موقع تراث'
	elseif I =='769'	then ab ='تداخل دوائي'
	elseif I =='798'	then ab ='تسمية عسكرية'
	elseif I =='800'	then ab ='نمایان ڪم'
	elseif I =='802'	then ab ='شاگرد'
	elseif I =='812'	then ab ='تعليمي تخصص'
	elseif I =='835'	then ab ='اختصار عالم حيوان'
	elseif I =='856'	then ab ='باضابطه ويب سائٽ'
	elseif I =='915'	then ab ='موقع تصوير'
	elseif I =='921'	then ab=' مرڪزي موضوع'
	elseif I =='935'	then ab ='ڪومنز ڳنڍڻو'
	elseif I =='957'	then ab ='آئي ايس بي اين نمبر'
	elseif I =='1036'	then ab ='ڈیوی نمبر'
	elseif I =='1040'	then ab ='فلم ايڊيٽر'
	elseif I =='1050'	then ab ='بيماري'
	elseif I =='1056'	then ab ='منتجات شركة'
	elseif I =='1066'	then ab ='استاد'
	elseif I =='1082'	then ab ='کل آبادي'
	elseif I =='1399'	then ab ='الزامات'
	elseif I =='1098'	then ab ='عدد المتحدثين'
	elseif I =='1104'	then ab=' تعداد صفحا'
	elseif I =='1120'	then ab ='وفاتون'
	elseif I =='1128'	then ab ='عدد موظفي شركة'
	elseif I =='1132'	then ab ='عدد المشاركين'
	elseif I =='1146'	then ab ='قالب اتحاد ألعاب القوى يستخدم بيانات'
	elseif I =='1233'	then ab ='قالب اسفدب يستخدم بيانات'
	elseif I =='1303'	then ab ='آلات فنان'
	elseif I =='1308'	then ab ='شاغل منصب'
	elseif I =='1308'	then ab ='شاغل منصب'
	elseif I =='1339'	then ab ='إصابات'
	elseif I =='1346'	then ab ='فاتح'
	elseif I =='1365'	then ab ='پيشرو'
	elseif I =='1366'	then ab ='جانشين'
	-- elseif I =='1409'	then ab ='قالب أرشيف ركوب الدراجات يستخدم بيانات'
	elseif I =='1412'	then ab ='لغة كاتب'
	elseif I =='1431'	then ab ='منتج تنفيذي'
	elseif I =='1442'	then ab ='صورة القبر'  --not yet
	elseif I =='1446'	then ab ='مفقودين'
	elseif I =='1447'	then ab ='قالب سبورتس رفرنس يستخدم بيانات'
	elseif I =='1448'	then ab ='باضابطہ نام'
	elseif I =='1451'	then ab ='شعار نصي'
	elseif I =='1476'	then ab ='عنوان'
	elseif I =='1477'	then ab ='ڄم نالو'
	elseif I =='1532'	then ab ='بلد الرياضة'
	elseif I =='1559'	then ab ='مقامي نالو'
	elseif I =='1562'	then ab ='عنوان أول موفي'
	elseif I =='1581'	then ab ='قالب مدونة رسمية بوصلة'
	elseif I =='1589'	then ab ='أخفض نقطة'
	elseif I =='1590'	then ab ='خسائر'
	elseif I =='1618'	then ab ='رقم لاعب'
	elseif I =='1663'	then ab ='قالب برو سايكلنج يستخدم بيانات'
	elseif I =='1705'	then ab ='اسم محلي'
	elseif I =='1798'	then ab ='آءِايس او ڪوڊ 639-5'
	elseif I =='1971'	then ab ='تعداد اولاد'
	elseif I =='1972'	then ab ='معرف أوبن هب يستخدم بيانات'
	elseif I =='1995'	then ab ='اختصاص مرض'
	elseif I =='2002'	then ab ='قالب تويتر يستخدم بيانات'
	elseif I =='2013'	then ab ='قالب فيس بوك يستخدم بيانات'
	elseif I =='2019'	then ab ='قالب اسم أول موفي يستخدم بيانات'
	elseif I =='2043'	then ab ='لمبائي'
	elseif I =='2044'	then ab ='سطح سمندر کان بلندي'
	elseif I =='2046'	then ab ='رقبه'
	elseif I =='2047'	then ab ='دورانیه'
	elseif I =='2049'	then ab ='اونچائی'
	elseif I =='2048'	then ab ='قد'
	elseif I =='2067'	then ab ='وزن'
	elseif I =='2073'	then ab ='مدى'
	elseif I =='2090'	then ab ='قالب باور اوف تن يستخدم بيانات'
	elseif I =='2097'	then ab ='مدت عہدہ'
	elseif I =='2096'	then ab ='وصف صورة'
	elseif I =='2101'	then ab ='نقطة الانصهار'
	elseif I =='344'	then ab ='ہدایت کار برائے عکس بندی'
	elseif I =='2142'	then ab ='إيرادات'
	elseif I =='2218'	then ab ='شخصی دولت'
	elseif I =='2250'	then ab ='متوسط العمر'
	elseif I =='2284'	then ab ='سعر الصرف'
	elseif I =='2386'	then ab ='قطر'
	elseif I =='2438'	then ab ='راوي'
	elseif I =='2522'	then ab ='فاتح شخصیت'
	elseif I =='2534'	then ab ='صيغة'
	elseif I =='2656'	then ab ='تصنيف الفيفا'
	elseif I =='2716'	then ab ='صورة مجمعة'--not yet 
	elseif I =='2910'	then ab ='إيقونة'--not yet 
	elseif I =='3383'	then ab ='ملصق فيلم'

	elseif I =='1546'	then ab ='شعار وطني'
	-- elseif I ==' '	then ab =' '
	-- elseif I ==' '	then ab =' '
	-- elseif I ==' '	then ab =' '
	-- elseif I ==' '	then ab =' '

	else   return   xt(s)
end
		 return wd(ab)
end

function p.pageId(frame)
	entity = mw.wikibase.getEntityObject()
	if not entity 
	then 
		return nil
	else 
		return entity.id
	end
end

function p.makecategory1(options)  --Main function
	prop = options['property']
	noicon = options['noicon'] -- options to hide the icon.
	nocate = options['nocate']  -- options to hide the category.
	q = options['category']
	iid = options['entityId'] or options['id']
	icon2 = options['icon2']
	if iid == '' or not iid then
             id = p.pageId()
             else id = iid 
      end
	if prop  == '' or not prop then
		return nil -- don't do anything if no options property.
	end
	propertyid = mw.ustring.gsub(prop:upper(), " ", "")

	icon = icons(propertyid,id,noicon,icon2)   -- function to display the icon.
	cate = category(propertyid,q,nocate) -- function to display the category.
	
	last = cate ..''.. icon
		return last
end

function p.makecategory(frame)  --Main function
	local final = p.makecategory1(frame.args)
	return final
end

function p.make1(prop,id)  --Main function
	if id == '' or not id then
             id = p.pageId()
             else id = iid 
      end
	if prop  == '' or not prop then
		return nil -- don't do anything if no args property.
	end
	propertyid = mw.ustring.gsub(prop:upper(), " ", "")

	icon = icons(propertyid,id,noicon)   -- function to display the icon.
	cate = category(propertyid,q,nocate) -- function to display the category.
	
	last = cate ..''.. icon
		return last
end


function p.SS(frame) --testing function
	s = mw.ustring.gsub(frame.args['property']:upper(), " ", "")
	s = list(s)
	s = mw.text.trim(s)
	if s  == '' or not s then
		return  nil
	end
	q = frame.args['category']
	if q  == '' or not q then
		return category(s)
        else return q
	end
	
end

return p