"Modül:GiftsByItem" sayfasının sürümleri arasındaki fark

Stardew Valley Wiki sitesinden
Gezinti kısmına atla Arama kısmına atla
2. satır: 2. satır:
  
 
function p.ts(frame)
 
function p.ts(frame)
         local villagerlist = {frame.args[1]}
+
         local villagerlist = frame.args["1"]
 
         local lang = string.upper(mw.getContentLanguage().code)
 
         local lang = string.upper(mw.getContentLanguage().code)
  
 
if lang == "DE" then
 
if lang == "DE" then
 
 
if villagerlist.find("Dwarf") then
 
if villagerlist.find("Dwarf") then
villagerlist.insert("Zwerg")
+
villagerlist.gsub("Dwarf" , "Zwerg")
villagerlist.remove("Dwarf")
 
 
elseif villagerlist.find("Wizard") then
 
elseif villagerlist.find("Wizard") then
villagerlist.insert("Zauberer")
+
villagerlist.gsub("Wizard", "Zauberer")
villagerlist.remove("Wizard")
 
 
end
 
end
  
23. satır: 20. satır:
  
 
elseif lang == "TR" then
 
elseif lang == "TR" then
            for k, v in pairs(villagerlist) do
+
villagerlist.gsub("Wizard", "Büyücü")
                if tostring(v) == "Dwarf" then
+
villagerlist.gsub("Dwarf", "Cüce")
    villagerlist.insert(Cuce) --This module has a problem with the umlauts in Cüce 😡
+
 
    villagerlist.remove(Dwarf)
 
                elseif  v == Wizard then
 
    villagerlist.insert("Büyücü")
 
    villagerlist.remove("Wizard")
 
end
 
            end
 
  
 
elseif lang == "ZH" then
 
elseif lang == "ZH" then
37. satır: 28. satır:
 
end
 
end
  
        table.sort(villagerlist)
+
         --table.sort(villagerlist)
         --table.concat( villagerlist, " • " )
+
         villagerlist.gsub(villagerlist, "," , " • ")
         --villagerlist:gsub(villagerlist, "," , " • ")
+
return villagerlist
return table.concat( villagerlist, " • " )
 
 
end
 
end
  
 
return p
 
return p

18.40, 17 Ocak 2023 tarihindeki hâli

Description

This module takes a comma-separated list of villager names and transforms it into a bullet-separated list of villager icons + links to villager pages.

This module performs tasks that were formerly performed by arrays (sorting, translating, and formatting) in Template:GiftsByItem.

This module can be copy/pasted into all languages without alteration.

Please report any problems or issues with the module on the discussion page for Template:GiftsByItem.


local p = {}

function p.ts(frame)
        local villagerlist = frame.args["1"]
        local lang = string.upper(mw.getContentLanguage().code)

	if lang == "DE" then
		if villagerlist.find("Dwarf") then
			villagerlist.gsub("Dwarf" , "Zwerg")
		elseif villagerlist.find("Wizard") then
			villagerlist.gsub("Wizard", "Zauberer")
		end		

	elseif lang == "FR" then
	  --for loop that replaces 'Robin' with 'Robine'
	  --Dwarf with ???
	  --and Wizard with ???

	elseif lang == "HU" then

	elseif lang == "TR" then
		villagerlist.gsub("Wizard", "Büyücü")
		villagerlist.gsub("Dwarf", "Cüce")


	elseif lang == "ZH" then

	end

        --table.sort(villagerlist)
        villagerlist.gsub(villagerlist, "," , " • ")
	return villagerlist
end

return p