مَوادَس کُن گٔژھِو

Module:IUCNstatus

وِکیٖپیٖڈیا پؠٹھٕ، اَکھ آزاد اِنسایکلوپیٖڈیا

"یَمہٕ ماڈیوٗلُک دَستاویز ییٚہِ Module:IUCNstatus/دَستاویز جاے بَناونہٕ"

local p = {}

-- Mapping of IUCN statuses to image + Kashmiri label
local statusData = {
	-- Short Codes
	["LC"] = { image = "Status iucn3.1 LC.svg", label = "کم از کم فِکِر کرُن لایَکھ" },
	["NT"] = { image = "Status iucn3.1 NT.svg", label = "قریٖب خطرٕ" },
	["VU"] = { image = "Status iucn3.1 VU.svg", label = "بَچاو رۆس" },
	["EN"] = { image = "Status iucn3.1 EN.svg", label = "خطرس مَنٛز" },
	["CR"] = { image = "Status iucn3.1 CR.svg", label = "سؠٹھاہ خطرس مَنٛز" },
	["EW"] = { image = "Status iucn3.1 EW.svg", label = "جَنٛگلس مَنٛز ختم" },
	["EX"] = { image = "Status iucn3.1 EX.svg", label = "ختم گٲمٕتؠ" },
	["DD"] = { image = "Status iucn3.1 blank bg.svg", label = "مولوٗماتھ کٔمی" },

	-- Full Name Mappings (Handles "Least concern", "Endangered", etc.)
	["LEAST CONCERN"] = { image = "Status iucn3.1 LC.svg", label = "کم از کم فِکِر کرُن لایَکھ" },
	["NEAR THREATENED"] = { image = "Status iucn3.1 NT.svg", label = "قریٖب خطرٕ" },
	["VULNERABLE"] = { image = "Status iucn3.1 VU.svg", label = "بَچاو رۆس" },
	["ENDANGERED"] = { image = "Status iucn3.1 EN.svg", label = "خطرس مَنٛز" },
	["CRITICALLY ENDANGERED"] = { image = "Status iucn3.1 CR.svg", label = "سؠٹھاہ خطرس مَنٛز" },
	["EXTINCT IN THE WILD"] = { image = "Status iucn3.1 EW.svg", label = "جَنٛگلس مَنٛز ختم" },
	["EXTINCT"] = { image = "Status iucn3.1 EX.svg", label = "ختم گٲمٕتؠ" },
	["DATA DEFICIENT"] = { image = "Status iucn3.1 blank.svg", label = "مولوٗماتھ کٔمی" }
}

function p.show(frame)
	-- Get the input and handle nil/empty, then convert to UPPERCASE
	local input = frame.args[1] or frame:getParent().args[1] or ""
	local code = mw.text.trim(input):upper()
	
	if code == "" then
		return ""
	end

	local data = statusData[code]
	if not data then
		-- Fallback: If code is not in the list, just return the text as it is
		return input
	end

	return string.format(
		'<div style="text-align:center;">[[File:%s|300px]]<br><small>%s</small></div>',
		data.image, data.label
	)
end

-- CRITICAL: This must be at the very end
return p