Modül:GiftsByItem
Margotbean (mesaj | katkılar) tarafından oluşturulmuş 21.24, 17 Ocak 2023 tarihli sürüm
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)
local list = {}
--villagerlist = villagerlist.gsub(villagerlist, "," , '\",\"')
--for k, v in pairs(villagerlist) do
--list.concat(list, tostring(v))
--end
--for k, v in ipairs(villagerlist) do
--for i=1, i < #villagerlist, 1 do
--list[i] = tostring(villagerlist[i])
--end
--end
if lang == "DE" then
--replace "Dwarf" with "Zwerg", "Wizard" with "Zauberer"
--s = s.gsub(villagerlist, "Wizard", "Zauberer")
elseif lang == "TR" then
--if villagerlist.find("Dwarf") then
--villagerlist.insert("Cüce")
--villagerlist.remove("Dwarf")
villagerlist = villagerlist.gsub(villagerlist, "Dwarf", "Cüce")
--end
--if villagerlist.find("Wizard") then
--villagerlist.insert("Büyücü")
--villagerlist.remove("Wizard")
villagerlist = villagerlist.gsub(villagerlist, "Wizard", "Büyücü")
--end
end
--table.sort(villagerlist)
villagerlist = villagerlist.gsub(villagerlist, "," , " • ")
return villagerlist
end
return p