Модул:Cycling race: Разлика помеѓу преработките

[проверена преработка][проверена преработка]
Избришана содржина Додадена содржина
correction
update
Ред 10:
"Journey origin", "Journey destination", "Teams", "Starting riders", "Arriving riders", "Average speed", "Cost", "Palmares", "Winner", "Second",
"Third", "Points", "Mountains", "Sprints", "Youth", "Combativity", "Combination", "Team"}
l10nDef["//br.wikipedia.org"] = {"Hollegezhioù", "Redadeg", "Kevezadeg", "Kevezadegoù", "Tennadoù", "Deiziad", "Deiziadoù", "Hed", "Bro", "Broioù",
"Lec'h loc'hañ", "Lec'h degouezhout", "Skipailhoù", "Loc'herien", "Erruerien", "Tizh keitat", "Koust", "Disoc'hoù", "Gounezer", "Eil", "Trede",
"Renkadur a-boentoù", "Kraper gwellañ", "Sprinter gwellañ", "Yaouank gwellañ", "Stourmer meur", "Gwellañ el liesrenkadur", "Skipailh gwellañ"}
l10nDef["//ca.wikipedia.org"] = {"Detalls de la cursa", "Cursa", "Competició", "Competicions", "Etapes", "Data", "Dates", "Distància", "País", "Països",
"Sortida", "Arribada", "Equips", "Inscrits", "Finalitzen", "Velocitat mitjana", "Cost", "Palmarès", "Vencedor", "Segon", "Tercer", "Punts", "Muntanya",
Ред 16 ⟶ 19:
"Start", "Ziel", "Teams", "Fahrer am Start", "Fahrer im Ziel", "Geschwindigkeit im Durchschnitt", "Kosten", "Sieger", "Gesamtwertung", "Zweiter",
"Dritter", "Punktewertung", "Bergwertung", "Sprintwertung", "Nachwuchswertung", "Kämpferischster Fahrer", "Kombinationswertung", "Teamwertung"}
l10nDef["//eo.wikipedia.org"] = {"Gxeneralajxo", "Bicikla konkurso", "Konkuro", "Konkuroj", "Etapoj", "Dato", "Datoj", "Longo", "Lando", "Landoj",
"Komencloko", "Alvenloko", "Teamoj", "Startantoj", "Alvenantoj", "Averagxa rapido", "Kosto", "Rezultoj", "Venkinto", "Dua pozicio", "Tria pozicio",
"Klasifiko laux poentoj", "Plej bona grimpanto", "Plej bona sprinto", "Plej bona juno", "Superbatalema", "Plej bona por kombino", "Plej bona teamo"}
l10nDef["//es.wikipedia.org"] = {"Detalles", "Carrera", "Válida para", "Válida para", "Etapas", "Fecha", "Fechas", "Distancia total", "País", "Países",
"Lugar de inicio", "Lugar de llegada", "Equipos", "Ciclistas que iniciaron", "Ciclistas que finalizaron", "Velocidad media", "Costo", "Clasificación final",
Ред 25 ⟶ 31:
"Држава", "Држави", "Поаѓалиште", "Одредиште", "Екипи", "Возачи на почеток", "Возачи на крај", "Просечна брзина", "Трошоци", "Добитници на наградите",
"Победник", "Второпласиран", "Третопласиран", "Бодовен", "Планински", "Спринтерски", "Младински", "Борбеност", "Комбиниран", "Екипен"}
l10nDef["//nl.wikipedia.org"] = {"wedstrijddetailsWedstrijddetails", "koersKoers", "wedstrijdWedstrijd", "wedstrijdenWedstrijden", "etappesEtappes", "datumDatum", "datumsDatums", "afstandAfstand", "landLand", "landenLanden", "startplaatsStartplaats",
"finishplaatsFinishplaats", "teamsTeams", "aantalAantal coureurs aan de start", "aantalAantal coureurs bij de aankomst", "gemiddeldeGemiddelde snelheid", "kostenKosten", "palmaresPalmares", "winnaarWinnaar", "tweedeTweede",
"derdeDerde", "puntenPunten", "bergenBergen", "sprintsSprints", "jeugdJeugd", "aanvalslustAanvalslust", "combinatieCombinatie", "teamTeam"}
l10nDef["//no.wikipedia.org"] = {"Detaljer", "Ritt", "Turnering", "Turneringer", "Etapper", "Dato", "Datoer", "Distanse", "Land", "Land",
"Startby", "Målby", "Lag", "Startende ryttere", "Fullførende ryttere", "Gjennomsnittsfart", "Kostnad", "Resultater", "Vinner", "2. plass", "3. plass",
"Poeng", "Klatre", "Sprint", "Ungdom", "Mest offensive", "Kombinasjon", "Lagkonkurranse"}
l10nDef["//pl.wikipedia.org"] = {"Wyrażenia ogólne", "Wyścig", "Konkurencja", "Konkursy", "Etapów", "Data", "Daty", "Dystans", "Państwo", "Państwy", "Odejście",
"Przyjazd", "Zespoły", "Zgłoszenia", "Ukończyło wyścig", "Średnia prędkość", "Koszt", "Podium", "Pierwsze miejsce", "Drugie miejsce", "Trzecie miejsce", "Punktowa",
"Górska", "Sprinterska", "Młodzieżowa", "Najaktywniejszych", "Kombinowana", "Drużynowa"}
l10nDef["//ro.wikipedia.org"] = {"Detalii cursă", "Cursă", "Competiție", "Competiții", "Etape", "Dată", "Date", "Distanță", "Țară", "Țări", "Start", "Sosire",
"Echipe", "Cicliști la start", "Cicliști la sosire", "Viteză medie", "Cost", "Palmares", "Câștigător", "Al doilea", "Al treilea", "Clasament pe puncte",
Ред 45 ⟶ 54:
function infobox_bottom(x) -- This function give the bottom of the infobox, with a link to the documentation, and the tooltip
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"[[d:ModuleWikidata:CyclingWikiProject raceCycling/Documentation/docinfobox|Documentation]]", "In Wikidata missing:"}
l10nDef["//en.wikipedia.org"] = {"[[d:ModuleWikidata:CyclingWikiProject raceCycling/Documentation/docinfobox|Documentation]]", "In Wikidata missing:"}
l10nDef["//cabr.wikipedia.org"] = {"[[d:ModuleWikidata:CyclingWikiProject raceCycling/Documentation/docinfobox|DocumentacióDocumentation]]", "In Wikidata missing:"}
l10nDef["//deca.wikipedia.org"] = {"[[d:ModuleWikidata:CyclingWikiProject raceCycling/Documentation/docinfobox|DokumentationDocumentació]]", "In Wikidata missing:"}
l10nDef["//esde.wikipedia.org"] = {"[[d:ModuleWikidata:CyclingWikiProject raceCycling/Documentation/docinfobox|DocumentaciónDokumentation]]", "In Wikidata missing:"}
l10nDef["//lbeo.wikipedia.org"] = {"[[d:ModuleWikidata:CyclingWikiProject raceCycling/Documentation/docinfobox|DokumentatiounDokumentado]]", "In Wikidata missing:"}
l10nDef["//mkes.wikipedia.org"] = {"[[d:ModuleWikidata:CyclingWikiProject raceCycling/Documentation/docinfobox|ДокументацијаDocumentación]]", "In Wikidata missing:"}
l10nDef["//rolb.wikipedia.org"] = {"[[d:ModuleWikidata:CyclingWikiProject raceCycling/Documentation/docinfobox|DocumentațieDokumentatioun]]", "In Wikidata missing:"}
l10nDef["//rumk.wikipedia.org"] = {"[[d:ModuleWikidata:CyclingWikiProject raceCycling/Documentation/docinfobox|ДокументацияДокументација]]", "In Wikidata missing:"}
l10nDef["//nl.wikipedia.org"] = {"[[d:Wikidata:WikiProject Cycling/Documentation/infobox|Documentatie]]", "In Wikidata missing:"}
l10nDef["//no.wikipedia.org"] = {"[[d:Wikidata:WikiProject Cycling/Documentation/infobox|Dokumentasjon]]", "In Wikidata missing:"}
l10nDef["//pl.wikipedia.org"] = {"[[d:Wikidata:WikiProject Cycling/Documentation/infobox|Dokumentacja]]", "In Wikidata missing:"}
l10nDef["//ro.wikipedia.org"] = {"[[d:Wikidata:WikiProject Cycling/Documentation/infobox|Documentație]]", "In Wikidata missing:"}
l10nDef["//ru.wikipedia.org"] = {"[[d:Wikidata:WikiProject Cycling/Documentation/infobox|Документация]]", "In Wikidata missing:"}
l10nDef["//www.wikidata.org"] = l10nDef["//fr.wikipedia.org"]
local l10n = l10nDef[mw.site.server]
Ред 72 ⟶ 86:
"winner of the sprint classification", "winner of the young rider classification", "winner of the fighting spirit classification",
"winner of the combination classification", "winner of the team classification" }
l10nDef["//www.wikidata.org"] = l10nDef["//fren.wikipedia.org"]
local l10n = l10nDef[mw.site.server]
if not l10n then l10n = l10nDef["//en.wikipedia.org"] end -- default
Ред 104 ⟶ 118:
if frame.args[property(3)] then tt.nr = frame.args[property(3)] end
if frame.args[property(4)] then tt.map = frame.args[property(4)] end
 
i = 5
forlocal kz in= pairs(t){stage=6, dostarttime=8, --t[k]endtime=9, ktime=10, length=11, startplace=12, endplace=13, ...nr_teams=14, nr_participants_start=15, nr_participants_end=16,
speed=17, cost=18, first=19, second=20, third=21, winner_point=22, winner_mountain=23, winner_sprint=24, winner_young=25, winner_fighting=26, winner_combination=27,
if frame.args[property(i)] then t[k] = frame.args[property(i)] end
winner_team=28}
i = i + 1
 
for i,k in pairs(z) do
if frame.args[property(k)] then t[i] = frame.args[property(k)] end
end
 
if entity:getLabel() ~= nil then tt.name = entity:getLabel()
else
Ред 135 ⟶ 152:
for _, v in pairs(entity.claims["P1132"]) do
if v.mainsnak then
if v.qualifiers["P276"][1].datavalue.value["numeric-id"] == 15053706529711 then
t.nr_participants_start = string.gsub(v.mainsnak.datavalue.value.amount, "+", "") end
if v.qualifiers["P276"][1].datavalue.value["numeric-id"] == 15053716 then
Ред 147 ⟶ 164:
if a == true and tt.nr == "" then
tt.nr = b .. ". "
if wiki == "//fr.wikipedia.org" or wiki == "//www.wikidata.org" then
if b == 1 then tt.nr = "1<sup>re</sup> " else tt.nr = b .."<sup>e</sup> " end end
if wiki == "//runl.wikipedia.org" orthen tt.nr = b .."e " end
if wiki == "//wwwru.wikidatawikipedia.org" then tt.nr = b .."-й " end
if wiki == "//eo.wikipedia.org" then tt.nr = b .."-a " end
end
-- Class of a cycling race. Class is: 1.UWT, 2.UWT, 1.HC, ... add new classes, no problem
Ред 161 ⟶ 180:
if "Q"..d == class[i] then t.class = "c"..d t.is_a = "Q"..b break end
end
else t.is_a = "Q"..b end -- if there is only one value, assume it is not a class
if a == true or c == true then t.is_a = "Q"..b end
end
 
a, b = pcall(fooA, 'numeric-id', entity, 'P361', 1) -- Competition of the cycling race : UCI World Tour 2016, UCI Europe Tour 2016...
Ред 168 ⟶ 189:
ttt.tour[i] = "T" .. v.mainsnak.datavalue.value["numeric-id"]
end
end
 
if t.stage == "" then
if pcall(function() -- This function count the number of value for P527 to determine the number of stages
if pcall(function() -- This function count the number of value for P527 to determine the number of stages
t.stage = table.getn(entity.claims["P527"])
t.stage = table.getn(entity.claims["P527"])
end
end
) then else t.stage = "" end
) then else t.stage = "" end
end
 
a1, b1, c1 = pcall(fooA, 'time', entity, 'P580', 1)
Ред 217 ⟶ 240:
elseif m ~= m2 then t.starttime = lang:formatDate( "Y. j. F", b1 )
else t.starttime = lang:formatDate( "Y. j.", b1 )
end end
if wiki == "//eo.wikipedia.org" then
if y ~= y2 then t.starttime = lang:formatDate( "j", b1 ) .."-a de ".. lang:formatDate( "F Y", b1 )
elseif m ~= m2 then t.starttime = lang:formatDate( "j", b1 ) .."-a de ".. lang:formatDate( "F", b1 )
else t.starttime = lang:formatDate( "j", b1 ) .."-a "
end end
end -- if a1
Ред 237 ⟶ 265:
elseif m ~= m2 then t.endtime = lang:formatDate( "j. F", b2 )
else t.endtime = lang:formatDate( "j. F", b2 )
end end
if wiki == "//eo.wikipedia.org" then
t.endtime = lang:formatDate( "j", b2 ) .."-a de ".. lang:formatDate( "F Y", b1 ) end
end -- if a2
 
Ред 255 ⟶ 285:
t.time = lang:formatDate( "F d, Y", b1 ) end
if wiki == "//lv.wikipedia.org" then
t.time = lang:formatDate( "Y. j. F", b1 ) end
if wiki == "//eo.wikipedia.org" then
t.time = lang:formatDate( "j", b1 ) .."-a de ".. lang:formatDate( "F Y", b1 ) end
end
 
Ред 341 ⟶ 373:
if b1 == "http://www.wikidata.org/entity/Q180154" then
t.speed_unit = 'km/h'
if wiki == "//nl.wikipedia.org" then t.speed_unit = 'km/u' end
if wiki == "//mk.wikipedia.org" then t.speed_unit = 'км/ч' end
if wiki == "//ru.wikipedia.org" then t.speed_unit = 'км/ч' end
Ред 365 ⟶ 398:
local note, qual, id
if wiki == "//fr.wikipedia.org" or wiki == "//en.wikipedia.org" or wiki == "//br.wikipedia.org" or wiki == "//ca.wikipedia.org" or
wiki == "//de.wikipedia.org" or wiki == "//eo.wikipedia.org" or wiki == "//es.wikipedia.org" or wiki == "//lb.wikipedia.org" or wiki == "//nl.wikipedia.org" or wiki == "//no.wikipedia.org" or wiki == "//pl.wikipedia.org" or
wiki == "//pt.wikipedia.org" or wiki == "//ro.wikipedia.org" then
note = 'f' else note = 'q' end
if pcall(foo3, entity, "P1346", 1, "P642", 1) then
for _, v in pairs(entity.claims["P1346"]) do
if pcall(function() id = v.mainsnak.datavalue.value['numeric-id'] end) then else id = nil end
qualif =pcall(function() qual=v.qualifiers["P642"][1].datavalue.value["numeric-id"] end) then else qual=nil end
if id ~=nil and qual~=nil and v.rank ~= 'deprecated' then
if qual == 20882667 and t.first == "" then t.first = note .. id results = true end
if qual == 20882668 and t.second == "" then t.second = note .. id results = true end
Ред 484 ⟶ 517:
tab = tab .. "margin:0 0.5em 0.5em 0; background-color:rgb(255, 255, 255); color:black; padding:5px; clear:left; "
tab = tab .. "text-align:left; font-size:85%; line-height:1.6em;'>"
if wiki == "//eo.wikipedia.org" then tab = "<table style='width:23em; border:1px solid rgb(200,200,200);"
 
tab = tab .. "margin:0 0.5em 0.5em 0; background-color:rgb(255, 255, 255); color:black; padding:5px; "
tab = tab .. "text-align:left; font-size:85%; line-height:1.6em;' class='infobox' >"
end
tab = tab .. "<tr><td colspan='2' style='border-bottom:5px solid white; font-size:175%; background:#FFDF80; text-align:center'>"
tab = tab .. "<table style='width:100%'><tr><td>[[File:Wikidata-logo S.svg|30px|link=d:".. frame.args[1] .. "]]</td><td>" .. tt.name .."</td><td>" .. tt.icon .. "</td></tr></table></td></tr>"
Ред 527 ⟶ 563:
tab = tab .. "<tr><td colspan='2' style='text-align:right; border-top:3px solid #FFDF80; font-size:75%'>" .. infobox_bottom(1)
--tab = tab .. "<span style='float:right' title='".. tooltip .. "'>[[File:High-contrast-help-browser.svg|10px|right|link=]]"
tab = tab .. "</span></td></tr></table>"
if wiki == "//eo.wikipedia.org" then tab = tab ..changetemplate() end
tab= tab.."</table>"
return tab
end
 
function p.teamroster(frame)
local columns = tonumber(frame.args.columns) == 1 and tonumber(frame.args.columns) or 2 --defaults to two columns
local squadSeason = mw.wikibase.getEntityObject( frame.args[1] )
local flags = {}
local riderIds = {}
local riderNames = {}
local riderBirthdays = {}
local labelMissing = false
local wiki = mw.site.server
local WDlink_off = false
 
-- WDlink_off is used to decide if a Wikidata flag will be shown
if wiki == "//www.wikidata.org" or wiki == "//fr.wikipedia.org" or wiki == "//en.wikipedia.org" or wiki == "//br.wikipedia.org" or wiki == "//ca.wikipedia.org" or
wiki == "//de.wikipedia.org" or wiki == "//eo.wikipedia.org" or wiki == "//es.wikipedia.org" or wiki == "//lb.wikipedia.org" or
wiki == "//nl.wikipedia.org" or wiki == "//no.wikipedia.org" or wiki == "//pl.wikipedia.org" or wiki == "//pt.wikipedia.org" or
wiki == "//ro.wikipedia.org" then WDlink_off = true end
 
local startOfSeason = squadSeason.claims["P580"][1].mainsnak.datavalue.value.time
 
local i = 1
while squadSeason.claims["P527"][i] do
riderIds[i] = 'Q' .. squadSeason.claims["P527"][i].mainsnak.datavalue.value['numeric-id']
local rider = mw.wikibase.getEntityObject(riderIds[i])
local label = rider:getLabel()
local link = rider:getSitelink()
if label == null then
label = '\'\'' .. rider:getLabel('en') .. '&nbsp;(en)\'\''
labelMissing = true
end
if link == null then
riderNames[i] = label
elseif label == link then
riderNames[i] = '[[' .. label .. ']]'
else
riderNames[i] = '[[' .. link .. '|' .. label .. ']]'
end
if pcall(function()
riderBirthdays[i] = rider.claims["P569"][1].mainsnak.datavalue.value.time
end
) then else riderBirthdays[i] = '' end
 
if pcall(function()
flags[i] = flag(getNationalityOnDate (riderIds[i], startOfSeason), startOfSeason)
end
) then else flags[i] = '' end
 
i = i + 1
end
 
local tableBody = ''
local tableHeader = '<table border="0" cellspacing="0" cellpadding="2" width="100%">'
.. '<tr style="background-color:#FFDF80;"><th width="35%" style="text-align:left;">'
if WDlink_off == true then tableHeader = tableHeader .. '[[File:Wikidata-logo S.svg|12px|link=d:'.. frame.args[1].. '#P527]]&nbsp;&nbsp;' end
tableHeader = tableHeader .. getSquadTableColumn(1) .. '</th><th width="42%" style="text-align:left;">' .. getSquadTableColumn(2) .. '</th></tr>'
local tableFoot = '</table>'
i = 1
local tableSize = table.getn(riderNames)
while riderNames[i] do
tableBody = tableBody ..'<tr><td nowrap >'..flags[i] .. ' '.. riderNames[i] .. ' '
if WDlink_off == false then tableBody = tableBody .. wdLink(riderIds[i]) end
tableBody = tableBody.. '</td><td nowrap >' ..getDateAndAgeOnDate(frame, startOfSeason, riderBirthdays[i]).. '</td></tr>'
 
if columns == 2 and math.floor((tableSize + 1)/2) == i then
tableBody = tableBody .. tableFoot ..'</td><td width="1%"></td><td style="vertical-align:top;" width="44%">' .. tableHeader
end
i = i + 1
end
local tableStart = '<table border="0"><tr><td style="vertical-align:top;" width="44%">'
local tableEnd = '</td></tr></table>'
if labelMissing then
tableEnd = tableEnd .. getMissingLabelTrackingCategory()
end
 
return '<table style="border:1px solid rgb(200,200,200)"><tr><td>'..
tableStart.. tableHeader.. tableBody.. tableFoot.. tableEnd.. '</td></tr></table>'
end
 
function getDateAndAgeOnDate (frame, onDate, date)
local lang = mw.language.getContentLanguage()
local wiki = mw.site.server
 
time = lang:formatDate( "j F Y", date )
if wiki == "//de.wikipedia.org" or wiki == "//no.wikipedia.org" then
time = lang:formatDate( "j. F Y", date ) end
if wiki == "//ja.wikipedia.org" then
time = lang:formatDate( "Y年m月d日", date ) end
if wiki == "//en.wikipedia.org" then
time = lang:formatDate( "F d, Y", date ) end
if wiki == "//lv.wikipedia.org" then
local _, _, y1, m1, d1 = string.find(onDate, "(%d+)-(%d+)-0*(%d+)")
time = frame:expandTemplate{ title = 'Template:Birth date and age2', args = { y1, m1, d1, y2, m2, d2 } } end
if wiki == "//eo.wikipedia.org" then
time = lang:formatDate( "j", date ) .."-a de ".. lang:formatDate( "F Y", date ) end
 
return time
end
 
Ред 590 ⟶ 733:
end
return link
end
 
function getMissingLabelTrackingCategory()
local l10nDef = { }
l10nDef["//lv.wikipedia.org"] = '[[Category:Vikidatos trūkst nosaukuma latviešu valodā]]'
 
local l10n = l10nDef[mw.site.server]
if not l10n then
l10n = ''
end
return l10n
end
 
function getSquadTableColumn(x)
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"Cycliste", "Date de naissance"}
l10nDef["//en.wikipedia.org"] = {"Rider", "Date of birth"}
l10nDef["//es.wikipedia.org"] = {"Corredor", "Fecha de nacimiento"}
l10nDef["//de.wikipedia.org"] = {"Name", "Geburtsdatum"}
l10nDef["//lv.wikipedia.org"] = {"Braucējs", "Dzimšanas datums"}
l10nDef["//mk.wikipedia.org"] = {"Велосипедист", "Датум на раѓање"}
l10nDef["//no.wikipedia.org"] = {"Rytter", "Fødselsdato"}
l10nDef["//ru.wikipedia.org"] = {"Гонщик", "Дата рождения"}
l10nDef["//www.wikidata.org"] = l10nDef["//en.wikipedia.org"]
 
local l10n = l10nDef[mw.site.server]
if not l10n then
l10n = l10nDef["//en.wikipedia.org"]
end
return l10n[x]
end
 
function changetemplate () -- for eoWiki
local frame = mw.getCurrentFrame()
local n = frame:expandTemplate {title="sxangxu sxablonon2", args = {["sxablono"] = "Cycling race/infobox"}}
return n
end
 
Ред 620 ⟶ 799:
for num=1,t.main.number do
table.insert(tt, "")
end
local wiki = mw.site.server
local winner, time_var, sitelink, nationality
local go
local WDlink_off = false
 
-- WDlink_off is used to decide if a Wikidata flag will be shown
if wiki == "//fr.wikipedia.org" or wiki == "//en.wikipedia.org" or wiki == "//br.wikipedia.org" or wiki == "//ca.wikipedia.org" or
wiki == "//de.wikipedia.org" or wiki == "//eo.wikipedia.org" or wiki == "//es.wikipedia.org" or wiki == "//lb.wikipedia.org" or
wiki == "//nl.wikipedia.org" or wiki == "//no.wikipedia.org" or wiki == "//pl.wikipedia.org" or wiki == "//pt.wikipedia.org" or
wiki == "//ro.wikipedia.org" then WDlink_off = true end
for num=1,t.main.number do
-- winner: Qnumber of vainqueur du classement général
Ред 631 ⟶ 818:
if go == true and t.main.race[num][2].claims["P1346"][i].qualifiers.P642[1].datavalue.value['numeric-id'] == winner_id then
winner = "Q"..t.main.race[num][2].claims["P1346"][i].mainsnak.datavalue.value['numeric-id']
if mw.site.serverwiki == "//www.wikidata.org" then sitelink = mw.wikibase.getEntity( winner ):getSitelink( 'frwiki' )
else sitelink = mw.wikibase.sitelink( winner )
end
Ред 638 ⟶ 825:
else sitelink = mw.wikibase.getEntity( winner ):getLabel()
end
if mw.site.serverwiki == "//lv.wikipedia.org" and mw.wikibase.getEntity( winner ):getLabel() == nil then
sitelink = mw.wikibase.getEntity( winner ):getLabel('en') .. " (en)" end
if mw.site.serverwiki == "//mk.wikipedia.org" and mw.wikibase.getEntity( winner ):getLabel() == nil then
sitelink = mw.wikibase.getEntity( winner ):getLabel('en') .. " (en)" end
if mw.site.serverwiki == "//ja.wikipedia.org" and mw.wikibase.getEntity( winner ):getLabel() == nil then
sitelink = mw.wikibase.getEntity( winner ):getLabel('en') .. " (en)" end
else sitelink = "[[" .. sitelink .. "|" .. string.gsub(sitelink, "%b()", "") .. "]]"
Ред 658 ⟶ 845:
if pcall(foo2, mw.wikibase.getEntity( winner ), "P27", 1) then -- standard: only one nationality
nationality = "Q"..mw.wikibase.getEntity( winner ).claims["P27"][1].mainsnak.datavalue.value['numeric-id']
tt[num] = flag(nationality, time_var) .. " " .. sitelink .. " " .. wdLink(winner)
if WDlink_off == false then tt[num] = tt[num].. wdLink(winner) end
else tt[num] = " " .. sitelink .. " " .. wdLink(winner) end
if pcall(foo2, mw.wikibase.getEntity( winner ), "P27", 2) then -- if person has more than one nationality calculate tt[num] again
tt[num] = flag( getNationalityOnDate (winner, time_var), time_var) .. " " .. sitelink .. " " .. wdLink(winner) end
if WDlink_off == false then tt[num] = tt[num].. wdLink(winner) end
end -- end if
end
end -- end if
i = i + 1
end -- end while
Ред 671 ⟶ 861:
 
function p.listofwinners(frame)
local t = {main={entity0="", race={}}, year={}, vainqueur={}, second={}, troisieme={}}
local table_first, table_proto, table_last, table_center
table_first = "<table cellpadding='4' cellspacing='0' style='border:1px solid rgb(200,200,200); color:black;"
table_first = table_first .. "margin:0 0 0.5em 0; background-color:rgb(255, 255, 255); padding:5px; clear:left; "
table_first = table_first .. "text-align:left; vertical-align:top; font-size:85%; line-height:1.6em;'>"
 
table_proto = {"<tr style='background:#FFDF80; text-align:center;'><th>", headoftableIV(1), "</th><th>",
headoftableIV(2), "</th><th>", headoftableIV(3), "</th><th>", headoftableIV(4), "</th></tr>"}
table_center = ""
table_last = "</table>"
 
local t = {main={entity0="", race={}}, year={}, vainqueur={}, deuxieme={}, troisieme={}}
-- entity0 =
-- race = {{q1, ..., 2013}, {q2, ..., 2014}} race[1]={race_Qnr, entity, time}
-- year =
-- vainqueur =
-- deuxieme =
-- troisieme =
if pcall(foo1, frame.args[1]) then t.main.entity0 = mw.wikibase.getEntity( frame.args[1] ) end
local tt, k, sitelink
local num = 1
local go
local wiki = mw.site.server
local WDlink_off = false
-- WDlink_off is used to decide if a Wikidata flag will be shown
if wiki == "//fr.wikipedia.org" or wiki == "//en.wikipedia.org" or wiki == "//br.wikipedia.org" or wiki == "//ca.wikipedia.org" or
wiki == "//de.wikipedia.org" or wiki == "//eo.wikipedia.org" or wiki == "//es.wikipedia.org" or wiki == "//lb.wikipedia.org" or
wiki == "//nl.wikipedia.org" or wiki == "//no.wikipedia.org" or wiki == "//pl.wikipedia.org" or wiki == "//pt.wikipedia.org" or
wiki == "//ro.wikipedia.org" then WDlink_off = true end
 
if pcall(foo2, t.main.entity0, "P527", num) then go = true else go = false end
while go == true and t.main.entity0.claims["P527"][num] do
Ред 713 ⟶ 897:
tt = {}
for num=1,t.main.number do -- build first column with link to wikipedia article and to wikidata item
if mw.site.serverwiki == "//www.wikidata.org" then sitelink = t.main.race[num][2]:getSitelink( 'frwiki' )
else sitelink = mw.wikibase.sitelink( t.main.race[num][1] )
end
Ред 719 ⟶ 903:
else sitelink = "[[" .. sitelink .. "|" .. t.main.race[num][3] .. "]]"
end
if WDlink_off == true then table.insert(tt, sitelink) else table.insert(tt, sitelink.. " " .. wdLink(t.main.race[num][1]) ) end
end
table.insert(t.year, tt)
table.insert(t.vainqueur, winner(t, 20882667))
table.insert(t.deuxiemesecond, winner(t, 20882668))
table.insert(t.troisieme, winner(t, 20882669))
 
local table_first, table_proto, table_last, table_center
table_first = "<table cellpadding='4' cellspacing='0' style='border:1px solid rgb(200,200,200); color:black;"
table_first = table_first .. "margin:0 0 0.5em 0; background-color:rgb(255, 255, 255); padding:5px; clear:left; "
table_first = table_first .. "text-align:left; vertical-align:top; font-size:85%; line-height:1.6em;'>"
 
table_proto = "<tr style='background:#FFDF80; text-align:center;'><th>"
if WDlink_off == true then table_proto = table_proto .. "[[File:Wikidata-logo S.svg|12px|link=d:".. frame.args[1].. "#P527]]" end
table_proto = table_proto.. headoftableIV(1).. "</th><th>"..
headoftableIV(2).. "</th><th>".. headoftableIV(3).. "</th><th>".. headoftableIV(4).. "</th></tr>"
table_center = ""
table_last = "</table>"
local table_center = ""
for var=1, t.main.number do -- t.main.race[var][3]
table_center = table_center .. "<tr><td style='text-align:center'>".. t.year[table.getn(t.year)][var].."</td>"
table_center = table_center .. "<td>"..t.vainqueur[table.getn(t.vainqueur)][var].."</td>"
table_center = table_center .. "<td>"..t.deuxiemesecond[table.getn(t.deuxiemesecond)][var].."</td>"
table_center = table_center .. "<td>"..t.troisieme[table.getn(t.troisieme)][var].."</td></tr>"
end
--return tt[1]table_first ..tt[2] table_proto ..tt[3] table_center .. table_last
return table_first .. table.concat(table_proto) .. table_center .. table_last
end
 
function p.listofstages(frame)
local i, v, uu, ii, nationality
local entity, etape, stage = {}, {}, {}
local entity = {}
local series_ordinal, point_of_time, length = {}, {}, {}
local sitelinks_etape, sitelinks1, sitelinks2, sitelinks3, sitelinks4 = {}, {}, {}, {}, {}
Ред 747 ⟶ 941:
local flag1, flag2 = {}, {}
local number0, number1, number2 = {}, {}, {}
local stagelevel = {}false
local level = 1
local a, b
local num, var
local wiki = mw.site.server
entity0 = mw.wikibase.getEntityObject( frame.args[1] ) -- Q18589873 (Quatre jours de Dunkerque 2015)
local entity0 = mw.wikibase.getEntityObject( frame.args[1] ) -- Q18589873 (Quatre jours de Dunkerque 2015)
 
local WDlink_off = false
-- begin level 1
local team = true
local table_first, table_proto, table_last
-- if there is one 'P527' then level = 2
table_first = "<table cellpadding='4' cellspacing='0' style='border:1px solid rgb(200,200,200); color:black;"
a, b = pcall(fooA, 'numeric-id', entity0, 'P527', 1)
table_first = table_first .. "margin:0 0 0.5em 0; background-color:rgb(255, 255, 255); padding:5px; clear:left; "
if a == true then level = true end
table_first = table_first .. "text-align:left; vertical-align:top; font-size:85%; line-height:1.6em;'>"
 
table_proto = {"<tr style='background:#FFDF80; text-align:center;'><th>", headoftable(1), "</th><th colspan='2'>",
headoftable(2), "</th><th>", headoftable(3), "</th><th>", headoftable(4), "</th><th>",
headoftable(5), "</th><th>", headoftable(6), "</th></tr>"}
table_last = "</table>"
-- missing is that the names in table_proto are taken from WD if possible
-- end level 1
local pp = entity0:getProperties()
-- look in all values of array `pp' and if there is one P527 then increase to level = 2
for i,v in ipairs(pp) do if v == 'P527' then level = 2 end end
-- only for level: 2
-- read series_ordinal and the Qnumber and sort them after series_ordinal, eg: 1 2a 2b 3 4 5
 
local num = 1
local parts = {}
for whilenum, levelv == 2 andin pairs(entity0.claims["P527"][num]) do do
etape[num] = 'Q'..entity0.claims["P527"][num]v.mainsnak.datavalue.value['numeric-id']
entity[num] = mw.wikibase.getEntityObject( etape[num] )
a, b = pcall(fooA, 'value', entity[num], 'P1545', 1)
if pcall(function ()
if a == true then series_ordinal[num] = b else series_ordinal[num] = entity[num].claims["P1545 "][1].mainsnak.datavalue.value end
end
) then else series_ordinal[num] = " " end
table.insert(parts, num, {nr = series_ordinal[num], Qnum = etape[num]})
end
num = num + 1
end
-- sort parts after nr = series_ordinal[num], not Qnum
table.sort(parts, function(a, b)
Ред 799 ⟶ 978:
return comp end)
--return a.nr < b.nr end)
 
-- WDlink_off is used to decide if a Wikidata flag will be shown
if wiki == "//fr.wikipedia.org" or wiki == "//en.wikipedia.org" or wiki == "//br.wikipedia.org" or wiki == "//ca.wikipedia.org" or
wiki == "//de.wikipedia.org" or wiki == "//eo.wikipedia.org" or wiki == "//es.wikipedia.org" or wiki == "//lb.wikipedia.org" or
wiki == "//nl.wikipedia.org" or wiki == "//no.wikipedia.org" or wiki == "//pl.wikipedia.org" or wiki == "//pt.wikipedia.org" or
wiki == "//ro.wikipedia.org" then WDlink_off = true end
var = #entity0.claims["P527"]
num = 1
for num=1,var do
while level == 2 and entity0.claims["P527"][num] do -- begin while loop 1; P527 (has part)
-- collect data from Wikidata in tables
entity[num] = mw.wikibase.getEntityObject( parts[num].Qnum )
if WDlink_off == true then number0[num]= " " else number0[num] = " " .. wdLink(parts[num].Qnum) end
sitelinks_etape[num] = entity[num]:getSitelink()
Ред 818 ⟶ 1.003:
if a == true then length[num] = formatNumber( b ) else length[num] = " " end
 
flag1[num] = ' '
-- find the vainqueur d'étape, Q20882747
sitelinks3[num] = ' '
i = 1
sitelinks3 number1[num] = "" --' "unknown3"'
local id, qual
number1[num] = ""
-- find the vainqueur d'étape, Q20882747
flag1[num] = ""
if pcall(foo3, entity[num], "P1346", 1, "P642", 1) then
if pcall(function()
for _, v in local t = pairs(entity[num].claims["P1346"][i] -- error or no) error?do
if pcall(function() id = v.mainsnak.datavalue.value['numeric-id'] end) then else id = nil end
end
qual = v.qualifiers["P642"][1].datavalue.value["numeric-id"]
) then -- t: no error
if id ~= nil and v.rank ~= 'deprecated' then
while entity[num].claims["P1346"][i] do
if qual == 20882747 then
if pcall(function()
number1[num] = 'Q' .. id
local t = entity[num].claims["P1346"][i].qualifiers.P642[1].datavalue.value['numeric-id']
-- flag1[num] = flag(getNationalityOnDate(number1[num], point_of_time[num]), point_of_time[num])
end
a, b = pcall(fooA, 'numeric-id', mw.wikibase.getEntityObject(number1[num]), 'P27', 1)
) then -- t: no error
if a == true then
if entity[num].claims["P1346"][i].qualifiers.P642[1].datavalue.value['numeric-id'] == 20882747 then
flag1[num] = flag( getNationalityOnDate (number1[num], point_of_time[num]), point_of_time[num])
number1[num] = 'Q'..entity[num].claims["P1346"][i].mainsnak.datavalue.value['numeric-id']
sitelinks3[num] = WPlink( number1[num] )
-- get nationality of the winner, nationality could have changed, therefore look for qualifiers p580 and p582
else
if pcall(foo2, mw.wikibase.getEntity( number1[num] ), "P27", 1) then -- standard: only one nationality
nationality a, b = "Q"..pcall(fooA, 'numeric-id', mw.wikibase.getEntitygetEntityObject( number1[num]), ).claims["P27"][1].mainsnak.datavalue.value['numeric-idP17'], 1)
if a == true then
flag1[num] = flag(nationality, point_of_time[num])
flag1[num] = flag( 'Q'..b, point_of_time[num])
end
sitelinks3[num] = WPlink( number1[num], team )
if pcall(foo2, mw.wikibase.getEntity( number1[num] ), "P27", 2) then -- if person has more than one nationality calculate flag1[num] again
end
flag1[num] = flag(getNationalityOnDate(number1[num], point_of_time[num]), point_of_time[num])
end end
if WDlink_off == true then number1[num]="" else number1[num]= " [[File:Wikidata-logo S.svg|12px|link=d:"..number1[num] .. ']]' end
if pcall(foo2, mw.wikibase.getEntity( number1[num] ), "P17", 1) then -- standard: only one nationality
end
nationality = "Q"..mw.wikibase.getEntity( number1[num] ).claims["P17"][1].mainsnak.datavalue.value['numeric-id']
end -- if id
flag1[num] = flag(nationality, point_of_time[num])
end -- endfor
end -- end if pcall
if pcall(foo2, mw.wikibase.getEntity( number1[num] ), "P17", 2) then -- if team has more than one nationality calculate flag1[num] again
flag1[num] = flag(getNationalityOnDate(number1[num], point_of_time[num]), point_of_time[num])
end
if pcall(function() -- find name of winner
sitelinks3[num] = " [[" .. mw.wikibase.sitelink(number1[num]) .. " |" .. string.gsub(mw.wikibase.sitelink(number1[num]), "%b()", "") .. "]]"
end
) then else
if mw.wikibase.label(number1[num]) ~= nil then sitelinks3[num] = " [[" .. mw.wikibase.label(number1[num]) .. "]]"
else sitelinks3[num] = " " .. mw.wikibase.getEntity( number1[num] ):getLabel('en') .. " (en)" .. " " end
end
number1[num] = " " .. wdLink(number1[num])
else
end -- end if
else -- t: error,
number1[num] = 'Q'..entity[num].claims["P1346"][i].mainsnak.datavalue.value['numeric-id']
--sitelinks3[num] = " [[" .. mw.wikibase.sitelink(number1[num]) .. "]]"
if pcall(function() -- find name of winners
sitelinks3[num] = " [[" .. mw.wikibase.sitelink(number1[num]) .. "|" .. string.gsub(mw.wikibase.sitelink(number1[num]), "%b()", "") .. "]]"
end
) then else sitelinks3[num] = " n.v. " end
if pcall(function()
flag1[num] = flag ('Q'..mw.wikibase.getEntity( number1[num] ).claims["P27"][1].mainsnak.datavalue.value['numeric-id'], point_of_time[num] )
end
) then else -- winning racing team (time trial) has no P27 but P17
flag1[num] = flag ('Q'..mw.wikibase.getEntity( number1[num] ).claims["P17"][1].mainsnak.datavalue.value['numeric-id'], point_of_time[num] )
end
number1[num] = " " .. wdLink(number1[num])
end -- end pcall
i = i + 1
end -- end while loop
else -- t: error
number1[num] = ""
sitelinks3[num] = "" -- "unknown3"
flag1[num] = ""
end -- end pcall
 
flag2[num] = ' '
sitelinks4[num] = ' '
number2[num] = ' '
local id, qual
-- find the leader du classement général à l'issue de l'étape, Q20882763
if pcall(foo3, entity[num], "P1346", 1, "P642", 1) then
i = 1
for _, v in pairs(entity[num].claims["P1346"]) do
sitelinks4[num] = "" --"unknown4"
if pcall(function() id = v.mainsnak.datavalue.value['numeric-id'] end) then else id = nil end
number2[num] = ""
qual = v.qualifiers["P642"][1].datavalue.value["numeric-id"]
flag2[num] = ""
if id ~= nil and v.rank ~= 'deprecated' then
if pcall(function()
if qual == 20882763 or qual == 20882667 then
local t = entity[num].claims["P1346"][i] -- error or no error?
number2[num] = 'Q' .. id
end
-- flag2[num] = flag( getNationalityOnDate (number2[num], point_of_time[num]), point_of_time[num])
) then -- t: no error
a, b = pcall(fooA, 'numeric-id', mw.wikibase.getEntityObject(number2[num]), 'P27', 1)
while entity[num].claims["P1346"][i] do
if a == true then
if pcall(function()
flag2[num] = flag( getNationalityOnDate(number2[num], point_of_time[num]), point_of_time[num])
local t = entity[num].claims["P1346"][i].qualifiers.P642[1].datavalue.value['numeric-id']
sitelinks4[num] = WPlink( number2[num] )
end
else
) then -- t: no error
a, b = pcall(fooA, 'numeric-id', mw.wikibase.getEntityObject(number2[num]), 'P17', 1)
if entity[num].claims["P1346"][i].qualifiers.P642[1].datavalue.value['numeric-id'] == 20882763 or entity[num].claims["P1346"][i].qualifiers.P642[1].datavalue.value['numeric-id'] == 20882667 then
if a == true then
number2[num] = 'Q'..entity[num].claims["P1346"][i].mainsnak.datavalue.value['numeric-id']
flag2[num] = flag( 'Q'..b, point_of_time[num])
-- get nationality of the winner, nationality could have changed
sitelinks4[num] = WPlink( number2[num], team )
if pcall(foo2, mw.wikibase.getEntity( number2[num] ), "P27", 1) then -- standard: only one nationality
end
nationality = "Q"..mw.wikibase.getEntity( number2[num] ).claims["P27"][1].mainsnak.datavalue.value['numeric-id']
end
flag2[num] = flag(nationality, point_of_time[num])
if WDlink_off == true then number2[num]="" else number2[num]= " [[File:Wikidata-logo S.svg|12px|link=d:"..number2[num] .. ']]' end
end
end
if pcall(foo2, mw.wikibase.getEntity( number2[num] ), "P27", 2) then -- if person has more than one nationality calculate flag2[num] again
end -- if id
flag2[num] = flag(getNationalityOnDate(number2[num], point_of_time[num]), point_of_time[num])
end -- for
end -- end if pcall
if pcall(foo2, mw.wikibase.getEntity( number2[num] ), "P17", 1) then -- standard: only one nationality
nationality = "Q"..mw.wikibase.getEntity( number2[num] ).claims["P17"][1].mainsnak.datavalue.value['numeric-id']
flag2[num] = flag(nationality, point_of_time[num])
end
if pcall(foo2, mw.wikibase.getEntity( number2[num] ), "P17", 2) then -- if team has more than one nationality calculate flag2[num] again
flag2[num] = flag(getNationalityOnDate(number2[num], point_of_time[num]), point_of_time[num])
end
if pcall(function() -- find name of winner
sitelinks4[num] = " [[" .. mw.wikibase.sitelink(number2[num]) .. "|" .. string.gsub(mw.wikibase.sitelink(number2[num]), "%b()", "") .. "]]"
end
) then else
if mw.wikibase.label(number2[num]) ~= nil then sitelinks4[num] = " [[" .. mw.wikibase.label(number2[num]) .. "]]"
else sitelinks4[num] = " " .. mw.wikibase.getEntity( number2[num] ):getLabel('en') .. " (en)" .. " " end
end
number2[num] = " " .. wdLink(number2[num])
else
end -- end if
else -- t: error,
number2[num] = 'Q'..entity[num].claims["P1346"][i].mainsnak.datavalue.value['numeric-id']
--sitelinks4[num] = " [[" .. mw.wikibase.sitelink(number2[num]) .. "]]"
if pcall(function() -- find name of winners
sitelinks4[num] = " [[" .. mw.wikibase.sitelink(number2[num]) .. "|" .. string.gsub(mw.wikibase.sitelink(number2[num]), "%b()", "") .. "]]"
end
) then else sitelinks4[num] = " n.v." end
if pcall(function()
flag2[num] = flag ('Q'..mw.wikibase.getEntity( number2[num] ).claims["P27"][1].mainsnak.datavalue.value['numeric-id'], point_of_time[num] )
end
) then else -- winning racing team (time trial) has no P27 but P17
flag2[num] = flag ('Q'..mw.wikibase.getEntity( number2[num] ).claims["P17"][1].mainsnak.datavalue.value['numeric-id'], point_of_time[num] )
end
number2[num] = " " .. wdLink(number2[num])
end -- end pcall
i = i + 1
end -- end while loop
else -- t: error
number2[num] = ""
sitelinks4[num] = "" --"unknown4"
flag2[num] = ""
end -- end pcall
 
if pcall(function()
-- find the type of stages
Ред 964 ⟶ 1.081:
end
) then else stage[num] = " " end
 
if pcall(function()
-- if type of stages == "team time trial" (Q2348250) then label3 = [[label3|official name]]
i = 1
uu = entity[num].claims["P31"][i].mainsnak.datavalue.value['numeric-id']
while entity[num].claims["P31"][i] do
if uu == 2348250 then -- "team time trial"
ii = 1
while entity[num].claims["P1346"][ii] do -- find the ii of the stage winner
local number = "Q"..entity[num].claims["P1346"][ii].mainsnak.datavalue.value['numeric-id'] -- e.g. Q19516702, Qnumber of stage winner
if pcall(function()
local official_name = mw.wikibase.getEntity( number ).claims["P1448"][1].mainsnak.datavalue.value.text
if mw.wikibase.label(number) ~= nil then sitelinks3[num] = string.sub(string.gsub(sitelinks3[num], "%b|]", "") , 0, -3).."|"..official_name.."]]" end
end -- end of function
) then end -- end of if
ii = ii + 1
end -- end while loop
end -- end of if
i = i + 1
end -- end while loop
end -- end of function
) then end -- end of if
 
_, _, y[num], m[num], d[num] = string.find(point_of_time[num], "(%d+)-(%d+)-(%d+)") -- d = day, m = month
 
end -- end for num = num + 1,var do
 
end -- end while loop 1
local table_first, table_proto, table_last
table_first = "<table cellpadding='4' cellspacing='0' style='border:1px solid rgb(200,200,200); color:black; "
table_first = table_first .. "margin:0 0 0.5em 0; background-color:rgb(255, 255, 255); padding:5px; clear:left; "
table_first = table_first .. "text-align:left; vertical-align:top; font-size:85%; line-height:1.6em;'>"
table_proto = "<tr style='background:#FFDF80; text-align:center;'><th>"
if WDlink_off == true then table_proto = table_proto .. "[[File:Wikidata-logo S.svg|12px|link=d:".. frame.args[1].. "#P527]]" end
table_proto = table_proto.. headoftable(1) .."</th><th>" .. headoftable(2) .."</th><th>".. headoftable(3)..
"</th><th>".. headoftable(4).. "</th><th>".. headoftable(5).."</th><th>".. headoftable(6).. "</th></tr>"
table_last = "</table>"
 
-- build table for output
local table_center = ""
var = #entity0.claims["P527"]
for var=1, num-1 do
for num=1, var do local a, b
local a, b
a, _ = string.gsub(series_ordinal[var], "%a", "") -- 20, not 20a
a, _ = string.gsub(series_ordinal[num], "%a", "") -- 20, not 20a
if string.find(series_ordinal[varnum], "%a") then b = string.sub(series_ordinal[varnum], string.find(series_ordinal[varnum], "%a"))
else b = "" end
local ee, er = stageLink(series_ordinal[varnum], a, b)
if series_ordinal[num] == "0" then
er = "#"..func_prologue()
if series_ordinal[var] == "0" then
er ee = "#"..func_prologue()
end
ee = func_prologue()
local stageNr -- if there is a wikipedia article of that stage show it or show the section
end
if sitelinks_etape[num] == nil then stageNr = "[["..er.."|"..ee.."]]" else stageNr = "[["..sitelinks_etape[num].."|"..ee.."]]" end
local stageNr -- if there is a wikipedia article of that stage show it or show the section
 
if sitelinks_etape[var] == nil then stageNr = "[["..er.."|"..ee.."]]" else stageNr = "[["..sitelinks_etape[var].."|"..ee.."]]" end
local day = tostring(tonumber(d[num]))
if day == "1" and (wiki == "//fr.wikipedia.org") then day = "1<sup>er</sup>"
local day = tostring(tonumber(d[var]))
else if daywiki == "1" and (mw.site.server =~= "//fr.wikipedia.org" orand mw.site.serverwiki =~= "//wwweo.wikidatawikipedia.org") then day = day .. "1<sup>er</sup>." end end
else if mw.site.serverwiki ~== "//frlv.wikipedia.org" then daystageNr = day .. "." endseries_ordinal[num] end
local month = func_month(m[num])
if mw.site.server == "//lv.wikipedia.org" then stageNr = series_ordinal[var] end
local date = day..' ' .. month
local month = func_month(m[var])
if wiki == "//ja.wikipedia.org" then date = month .. day .. "日" end
localif wiki == "//eo.wikipedia.org" then date = day .. "</td><td>-a de ".. month end
 
if mw.site.server == "//ja.wikipedia.org" then date = month .. "</td><td style='padding-left:0px'>" .. day .. "日" end
if pcall(function()
length[num] = mw.language.getContentLanguage():formatNum(tonumber(length[num]))
if pcall(function()
end
length[var] = mw.language.getContentLanguage():formatNum(tonumber(length[var]))
) then else length[num] = " " end
 
) then else length[var] = " " end
table_center = table_center.. "<tr style='vertical-align:top'><td nowrap style='text-align:right'>".. stageNr .. number0[num]..
--length[var] = mw.language.getContentLanguage():formatNum(tonumber(length[var]))
"</td><td nowrap style='text-align:right; padding-right:0px'>"..date.. "</td><td>".. sitelinks1[num].." – "..sitelinks2[num]..stage[num]..
"</td><td style='text-align:center'>".. length[num].. " </td><td nowrap>".. flag1[num].. ' '.. sitelinks3[num].. number1[num].. "</td><td nowrap>"..
table_center = table_center.."<tr style='vertical-align:top'><td style='text-align:right'>".. stageNr .. number0[var]
flag2[num]..' ' ..sitelinks4[num].. number2[num].. "</td></tr>"
table_center = table_center.."</td><td style='text-align:right; padding-right:0px'>"..date
table_center = table_center.."</td><td>"..sitelinks1[var].." – "..sitelinks2[var]..stage[var].."</td><td style='text-align:center'>"
table_center = table_center..length[var].." </td><td>"..flag1[var]..sitelinks3[var]..number1[var]
table_center = table_center.."</td><td>"..flag2[var]..sitelinks4[var]..number2[var].."</td></tr>"
end
if level == 1 then return table_first .. table.concat(table_proto) .. table_last end
 
returnlocal tabl = table_first .. table.concat(table_proto) .. table_center .. table_last
if level == true then tabl = tabl .. table_center .. table_last else tabl = tabl .. table_last end
return tabl
end
 
function func_prologue() -- returns the word "Prologue"
local l10nDef = { ["fr"]="Prologue", ["en"]="Prologue", ["br"]="Prolog", ["ca"]="Pròleg", ["cs"]="Prolog", ["de"]="P", ["da"]="Prolog", ["eo"]="Prologo",
local translDef = { ["//www.wikidata.org"] = "Prologue",
["es"]="Prólogo", ["fi"]="Prologi", ["hu"]="Prolog", ["it"]="Prologo", ["ja"]="プロローグ", ["la"]="Incipit prologus", ["lb"]="Prolog", ["lv"]="Prologs",
["//fr.wikipedia.org"] = "Prologue",
["mk"]="Пролог", ["nl"]="Proloog", ["no"]="Prolog", ["pl"]="Prologu", ["pt"]="Prólogo", ["ro"]="Prolog", ["ru"]="Пролог", ["sk"]="Prológ", ["sv"]="Prolog" }
["//en.wikipedia.org"] = "Prologue",
["//br.wikipedia.org"] = "Prolog",
["//ca.wikipedia.org"] = "Pròleg",
["//cs.wikipedia.org"] = "Prolog",
["//de.wikipedia.org"] = "Prolog",
["//da.wikipedia.org"] = "Prolog",
["//es.wikipedia.org"] = "Prólogo",
["//fi.wikipedia.org"] = "Prologi",
["//hu.wikipedia.org"] = "Prolog",
["//it.wikipedia.org"] = "Prologo",
["//ja.wikipedia.org"] = "プロローグ",
["//la.wikipedia.org"] = "Incipit prologus",
["//lb.wikipedia.org"] = "Prolog",
["//lv.wikipedia.org"] = "Prologs",
["//mk.wikipedia.org"] = "Пролог",
["//nl.wikipedia.org"] = "Proloog",
["//no.wikipedia.org"] = "Prolog",
["//pl.wikipedia.org"] = "Prologu",
["//pt.wikipedia.org"] = "Prólogo",
["//ro.wikipedia.org"] = "Prolog",
["//ru.wikipedia.org"] = "Пролог",
["//sk.wikipedia.org"] = "Prológ",
["//sv.wikipedia.org"] = "Prolog" }
 
local word = translDef[mw.site.server]
if not word then word = translDef["//fr.wikipedia.org"] end -- default
return word
end
local wiki,word=mw.site.server
if wiki=='//www.wikidata.org' then return l10nDef["fr"]
else return l10nDef[string.sub(wiki,string.find(wiki,"%a+"))] end
end
 
function stageLink(x, a, b) -- x= 10a: a = 10, b = a. x = 5: a = 5, b = ""
local l10nDef = {["fr"]="étape", ["en"]="Stage", ["br"]="Tennad", ["ca"]="Etapa", ["cs"]="Etapa", ["de"]="Etappe", ["da"]="Etape", ["eo"]="Etapo",
local translDef = { ["//www.wikidata.org"] = "étape",
["es"]="Etapa", ["eu"]="Etapa", ["fi"]="Etappi", ["hu"]="Szakasz", ["it"]="Tappa", ["ja"]="ステージ", ["la"]="Statio", ["lb"]="Etapp", ["lv"]="Posms", ["mk"]="Етапа",
["//fr.wikipedia.org"] = "étape",
["nl"]="Etappe", ["no"]="Etappe", ["pl"]="Etap", ["pt"]="Etapa", ["ro"]="Etapa", ["ru"]="Этап", ["sk"]="Etapa", ["sv"]="Etapp" }
["//en.wikipedia.org"] = "Stage",
["//br.wikipedia.org"] = "Tennad",
["//ca.wikipedia.org"] = "Etapa",
["//cs.wikipedia.org"] = "Etapa",
["//de.wikipedia.org"] = "Etappe",
["//da.wikipedia.org"] = "Etape",
["//es.wikipedia.org"] = "Etapa",
["//fi.wikipedia.org"] = "Etappi",
["//hu.wikipedia.org"] = "Szakasz",
["//it.wikipedia.org"] = "Tappa",
["//ja.wikipedia.org"] = "ステージ",
["//la.wikipedia.org"] = "Statio",
["//lb.wikipedia.org"] = "Etapp",
["//lv.wikipedia.org"] = "Posms",
["//mk.wikipedia.org"] = "Етапа",
["//nl.wikipedia.org"] = "Etappe",
["//no.wikipedia.org"] = "Etappe",
["//pl.wikipedia.org"] = "Etap",
["//pt.wikipedia.org"] = "Etapa",
["//ro.wikipedia.org"] = "Etapa",
["//ru.wikipedia.org"] = "Этап",
["//sk.wikipedia.org"] = "Etapa",
["//sv.wikipedia.org"] = "Etapp" }
 
local word wiki,l10n= translDef[mw.site.server]
local word1, word2
if wiki=='//www.wikidata.org' then word2=l10nDef["fr"]
if not word then
else word2=l10nDef[string.sub(wiki,string.find(wiki,"%a+"))] end
word2 = translDef["//fr.wikipedia.org"] -- default
local word = word2
end
 
-- fr: {{1re}} étape, {{2e}} étape
if mw.site.server == "//www.wikidata.org" or mw.site.server == "//fr.wikipedia.org" then
if b == "" then -- series_ordinal without character
if a == "1" then word1 = "1<sup>re</sup> "..word else word1 = a.."<sup>e</sup> "..word end -- table text = {{1re}} étape, {{2ae}} étape,
Ред 1.120 ⟶ 1.179:
end
 
function func_month(x) -- l10nDef["//.wikipedia.org"] = {"", "", "", "", "", "", "", "", "", "", "", ""}
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."}
l10nDef["//en.wikipedia.org"] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
l10nDef["//be.wikipedia.org"] = {"studz.", "liut.", "sak.", "kras.", "mai.", "cherv.", "lip.", "zhniven'", "veras", "kastr.", "list.", "snezh."}
l10nDef["//bg.wikipedia.org"] = {"ian.", "fevr.", "mart", "april", "mai", "iuni", "iuli", "avg.", "sept.", "okt.", "noem.", "dek."}
l10nDef["//br.wikipedia.org"] = {"Genver", "C'hwevrer", "Meurzh", "Ebrel", "Mae", "Mezheven", "Gouere", "Eost", "Gwengolo", "Here", "Du", "Kerzu"}
l10nDef["//ca.wikipedia.org"] = {"gener", "febrer", "març", "abril", "maig", "juny", "juliol", "agost", "setembre", "octubre", "novembre", "desembre"}
l10nDef["//cs.wikipedia.org"] = {"led.", "ún.", "brez.", "dub.", "kvet.", "cerv.", "cerven.", "srp.", "záríj.", "ríj.", "list.", "pros."}
l10nDef["//da.wikipedia.org"] = {"jan.", "febr.", "marts", "april", "maj", "juni", "juli", "aug.", "sept.", "okt.", "nov.", "dec."}
l10nDef["//de.wikipedia.org"] = {"Jan.", "Feb.", "März", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sept.", "Okt.", "Nov.", "Dez."}
l10nDef["//es.wikipedia.orgeo"] = {"enerojanu.", "febfebr.", "marzomarto", "abrapr.", "mayomajo", "jun.", "jul.", "agostoauxg.", "sept.", "octokt.", "nov.", "dicdec."}
l10nDef["//et.wikipedia.orges"] = {"jaan.enero", "veebrfeb.", "märtsmarzo", "aprabr.", "maimayo", "juunijun.", "juulijul.", "aug.agosto", "sept.", "oktoct.", "nov.", "detsdic."}
l10nDef["//hu.wikipedia.orget"] = {"janjaan.", "febveebr.", "márc.märts", "áprapr.", "máj.mai", "jun.juuni", "jul.juuli", "aug.", "szeptsept.", "okt.", "nov.", "decdets."}
l10nDef["//id.wikipedia.orgeu"] = {"Djan.urtarrilaren", "Peb.otsailaren", "Mrt.martxoaren", "Apr.apirilaren", "Maimaiatzaren", "Djuniekainaren", "Djuliuztail", "Ag.abuztuaren", "Sept.irailaren", "Okt.urri", "Nop.azaroaren", "Des.abenduaren"}
l10nDef["//it.wikipedia.orghu"] = {"gennjan.", "febbrfeb.", "marmárc.", "aprápr.", "maggmáj.", "giugnojun.", "lugliojul.", "agaug.", "settszept.", "ottokt.", "nov.", "dicdec."}
l10nDef["//ja.wikipedia.orgid"] = {"1月Djan.", "2月Peb.", "3月Mrt.", "4月Apr.", "5月Mai", "6月Djuni", "7月Djuli", "8月Ag.", "9月Sept.", "10月Okt.", "11月Nop.", "12月Des."}
l10nDef["//la.wikipedia.orgit"] = {"Iangenn.", "Febrfebbr.", "Martmar.", "Aprapr.", "Maimagg.", "Iun.giugno", "Iul.luglio", "Augag.", "Septsett.", "Octott.", "Novnov.", "Decdic."}
l10nDef["//lb.wikipedia.orgja"] = {"Januar1月", "Februar2月", "Mäerz3月", "Abrëll4月", "Mee5月", "Juni6月", "Juli7月", "August8月", "September9月", "Oktober10月", "November11月", "Dezember12月"}
l10nDef["//lt.wikipedia.orgla"] = {"sausIan.", "vasFebr.", "kovasMart.", "balApr.", "gegMai.", "birzIun.", "liepaIul.", "rugpAug.", "rugsSept.", "spalisOct.", "lapkrNov.", "grDec."}
l10nDef["//lv.wikipedia.orglb"] = {"janvārisJanuar", "februārisFebruar", "martsMäerz", "aprīlisAbrëll", "maijsMee", "jūnijsJuni", "jūlijsJuli", "augustsAugust", "septembrisSeptember", "oktobrisOktober", "novembrisNovember", "decembrisDezember"}
l10nDef["//mk.wikipedia.orglt"] = {"јануариsaus.", "февруариvas.", "мартkovas", "априлbal.", "мајgeg.", "јуниbirz", "јулиliepa", "августrugp.", "септемвриrugs.", "октомвриspalis", "ноемвриlapkr.", "декемвриgr."}
l10nDef["//ms.wikipedia.orglv"] = {"Jan.janvāris", "Feb.februāris", "Macmarts", "Apr.aprīlis", "Meimaijs", "Junjūnijs", "Julaijūlijs", "Ogaugusts", "Sept.septembris", "Okt.oktobris", "Nov.novembris", "Dis.decembris"}
l10nDef["//no.wikipedia.orgmk"] = {"jan.јануари", "feb.февруари", "mar.март", "apr.април", "maiмај", "jun.јуни", "jul.јули", "aug.август", "sep.септември", "okt.октомври", "nov.ноември", "des.декември"}
l10nDef["//nl.wikipedia.orgms"] = {"janJan.", "febFeb.", "maartMac", "aprApr.", "meiMei", "juniJun", "juliJulai", "aug.Og", "septSept.", "oktOkt.", "novNov.", "decDis."}
l10nDef["//pl.wikipedia.orgno"] = {"styczjan.", "lutyfeb.", "mar.", "kwiecapr.", "majmai", "czerwjun.", "lipjul.", "sierpaug.", "wrzessep.", "pazdzokt.", "listopnov.", "grudzdes."}
l10nDef["//pt.wikipedia.orgnl"] = {"jan.", "fevfeb.", "marçomaart", "abrilapr.", "maiomei", "junhojuni", "julhojuli", "agostoaug.", "setsept.", "outokt.", "nov.", "dezdec."}
l10nDef["//ro.wikipedia.orgpl"] = {"Ianstycz.", "Feb.luty", "Marmar.", "Aprkwiec.", "Maimaj", "Iunczerw.", "Iullip.", "Augsierp.", "Sepwrzes.", "Octpazdz.", "Novlistop.", "Decgrudz."}
l10nDef["//ru.wikipedia.orgpt"] = {"Январяjan.", "Февраляfev.", "Мартаmarço", "Апреляabril", "Маяmaio", "Июняjunho", "Июляjulho", "Августаagosto", "Сентябряset.", "Октябряout.", "Ноябряnov.", "Декабряdez."}
l10nDef["//sh.wikipedia.orgro"] = {"sijecIan.", "veljFeb.", "ozujMar.", "travApr.", "svib.Mai", "lipIun.", "srpIul.", "kolAug.", "rujSep.", "listOct.", "studNov.", "prosDec."}
l10nDef["//sk.wikipedia.orgru"] = {"l'ad.Января", "ún.Февраля", "brez.Марта", "dub.Апреля", "kvetМая", "cerv.Июня", "cerven.Июля", "srp.Августа", "zári.Сентября", "ruj.Октября", "list.Ноября", "pros.Декабря"}
l10nDef["//sl.wikipedia.orgsh"] = {"jansijec.", "febvelj.", "marozuj.", "aprtrav.", "majsvib.", "junlip.", "julsrp.", "avgkol.", "septruj.", "oktlist.", "novstud.", "decpros."}
l10nDef["//sv.wikipedia.orgsk"] = {"janl'ad.", "febrún.", "marsbrez.", "aprildub.", "majkvet", "junicerv.", "julicerven.", "augsrp.", "septzári.", "oktruj.", "novlist.", "decpros."}
l10nDef["sl"] = {"jan.", "feb.", "mar.", "apr.", "maj", "jun.", "jul.", "avg.", "sept.", "okt.", "nov.", "dec."}
l10nDef["sv"] = {"jan.", "febr.", "mars", "april", "maj", "juni", "juli", "aug.", "sept.", "okt.", "nov.", "dec."}
 
local wiki,l10n = l10nDef[mw.site.server]
if not l10nwiki=='//www.wikidata.org' then l10n =return l10nDef["//fr.wikipedia.org"] end -- default[tonumber(x)]
else return l10nl10nDef[string.sub(wiki,string.find(wiki,"%a+"))][tonumber(x)] end
end
 
function headoftable(x) -- En-tête du tableau listant les étapes
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"Étape", "Date", "Villes étapes", "Distance (km)", "Vainqueur d'étape", "Leader du classement général"}
l10nDef["//en.wikipedia.org"] = {"Stage", "Date", "Course", "Distance (km)", "Stage winner", "Overall leader"}
l10nDef["//br.wikipedia.org"] = {"Tennad", "Deiziad", "Kêr loc'hañ ha kêr degouezhout", "Hed (km)", "Trec'hour", "E penn ar renkamant hollek"}
l10nDef["//ca.wikipedia.org"] = {"Etapa", "Data", "Ciutats d'etapa", "Distància (km)", "Vencedor de l'etapa", "Líder de la general"}
l10nDef["//cs.wikipedia.org"] = {"Etapa", "Datum", "Trasa", "Vzdálenost (km)", "Vítěz", "Průběžný lídr"}
l10nDef["//da.wikipedia.org"] = {"Etape", "Dato", "Start – Mål", "Afstand (km)", "Etapevinder", "Den gule trøje"}
l10nDef["//de.wikipedia.org"] = {"Etappe", "Datum", "Etappenorte", "Länge (km)", "Etappensieger", "Gesamtführender"}
l10nDef["//es.wikipedia.orgeo"] = {"EtapaEtapo", "FechaDato", "RecorridoEtapa urbo", "DistanciaLongo (km)", "GanadorVenkinto de la etapo", "LíderEstro de la gxeneralo klasado"}
l10nDef["//fi.wikipedia.orges"] = {"EtappiEtapa", "PäiväFecha", "ReittiRecorrido", "PituusDistancia (km)", "VoittajaGanador", "Yleinen johtajaLíder"}
l10nDef["//hu.wikipedia.orgfi"] = {"SzakaszEtappi", "IdőpontPäivä", "VégpontokReitti", "HosszPituus (km)", "SzakaszgyőztesVoittaja", "ÁltalánosYleinen vezetőjohtaja"}
l10nDef["//it.wikipedia.orghu"] = {"TappaSzakasz", "DataIdőpont", "PercorsoVégpontok", "DistanzaHossz (km)", "Vincitore di tappaSzakaszgyőztes", "Leader cl.Általános generalevezető"}
l10nDef["//ja.wikipedia.orgit"] = {"ステージTappa", "開催日Data", "コースPercorso", "距離Distanza (km)", "ステージ勝者Vincitore di tappa", "全体リーダーLeader cl. generale"}
l10nDef["//la.wikipedia.orgja"] = {"Statioステージ", "Dies開催日", "Iterコース", "Distantia距離 (km)", "Victorステージ勝者", "Altiore princeps全体リーダー"}
l10nDef["//lb.wikipedia.orgla"] = {"EtappStatio", "DatumDies", "EtappestiedIter", "LängtDistantia (km)", "GewënnerVictor", "GeneralklassementAltiore princeps"}
l10nDef["//lv.wikipedia.orglb"] = {"PosmsEtapp", "DatumsDatum", "MaršrutsEtappestied", "Posma garumsLängt (km)", "UzvarētājsGewënner", "Kopvērtējuma līderisGeneralklassement"}
l10nDef["//mk.wikipedia.orglv"] = {"ЕтапаPosms", "ДатумDatums", "ТекMaršruts", "РастојаниеPosma garums (кмkm)", "ПобедникUzvarētājs", "CевкупенKopvērtējuma лидерlīderis"}
l10nDef["//nl.wikipedia.orgmk"] = {"EtappeЕтапа", "DatumДатум", "Start – FinishТек", "AfstandРастојание (kmкм)", "WinnaarПобедник", "KlassementsleiderCевкупен лидер"}
l10nDef["//no.wikipedia.orgnl"] = {"Etappe", "DatoDatum", "Start – MålgangFinish", "LengdeAfstand (km)", "EtappevinnerWinnaar", "SammenlagtlederKlassementsleider"}
l10nDef["//pl.wikipedia.orgno"] = {"EtapEtappe", "DataDato", "Start – MetaMålgang", "DystansLengde (km)", "Zwycięzca etapuEtappevinner", "LiderSammenlagtleder"}
l10nDef["//pt.wikipedia.orgpl"] = {"EtapaEtap", "Data", "PercursoStart – Meta", "DistânciaDystans (km)", "VencedorZwycięzca etapu", "Líder geralLider"}
l10nDef["//ro.wikipedia.orgpt"] = {"Etapa", "DatăData", "Start – SosirePercurso", "DistanțăDistância (km)", "CâștigătorVencedor", "LiderulLíder globalgeral"}
l10nDef["//ru.wikipedia.orgro"] = {"ЭтапEtapa", "ДатаDată", "МаршрутStart – Sosire", "ДлинаDistanță (кмkm)", "ПобедительCâștigător", "Лидер генеральнойLiderul классификацииglobal"}
l10nDef["//sk.wikipedia.orgru"] = {"EtapaЭтап", "DátumДата", "TrasaМаршрут", "VzdialenosťДлина (kmкм)", "VíťazПобедитель", "PriebežnýЛидер генеральной líderклассификации"}
l10nDef["//sv.wikipedia.orgsk"] = {"EtappEtapa", "DatumDátum", "Start – målTrasa", "DistansVzdialenosť (km)", "Skede vinnareVíťaz", "ÖvergripandePriebežný ledarelíder"}
l10nDef["sv"]={"Etapp", "Datum", "Start – mål", "Distans (km)", "Skede vinnare", "Övergripande ledare"}
l10nDef["//als.wikipedia.org"] = l10nDef["//de.wikipedia.org" ]
l10nDef["als"]=l10nDef["de"]
l10nDef["//www.wikidata.org"] = {"Étape", "Date", "Villes étapes", "Dist. (km)", "Vainqueur d'étape", "Leader du classement général"}
 
local wiki,l10n = l10nDef[mw.site.server]
if not l10nwiki=='//www.wikidata.org' then l10n = l10nDef["//fr.wikipedia.org"] end -- default
else l10n=l10nDef[string.sub(wiki,string.find(wiki,"%a+"))] end
 
-- local l10n = l10nDef[mw.site.server]
-- if not l10n then l10n = l10nDef["//fr.wikipedia.org"] end -- default
return l10n[x]
end
Ред 1.196 ⟶ 1.261:
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"Coureur", "Pays", "Équipe", "Temps", "Points", "Classement de l'étape", "Classement général", "Classement par points", "Classement de la montagne", "Classement des sprints", "Classement du meilleur jeune", "Classement par équipes"}
l10nDef["//br.wikipedia.org"] = {"Reder", "Bro", "Skipailh", "Amzer", "Poentoù", "Renkadur an tennad", "Renkadur hollek", "Renkadur a-boentoù", "Renkadur ar menez", "Renkadur ar sprintoù", "Renkadur ar yaouank gwellañ", "Renkadur a-skipailh"}
l10nDef["//ca.wikipedia.org"] = {"Corredor", "País", "Equip", "Temps", "Punts", "Classificació de l'etapa", "Classificació general", "Classificació per punts", "Classificació de la muntanya", "Classificació dels esprints", "Classificació del millor jove", "Classificació per equips"}
l10nDef["//eo.wikipedia.org"] = {"Kuranto", "Lando", "Teamo", "Tempo", "Poentoj", "Etapa klasifiko", "Gxenerala klasifiko", "Klasifiko laux poentoj", "Klasifiko por la montaro", "Klasifiko por la sprintoj", "Klasifiko de la plej bona juno", "Klasifiko po teamo"}
l10nDef["//lb.wikipedia.org"] = {"Coureur", "Land", "Equipe", "Zäit", "Punkten", "Etappeklassement", "Generalklassement", "Klassement no Punkten", "Biergpräis", "Sprintklassement", "Beschte Jonken", "Equippeklassement"}
l10nDef["//ro.wikipedia.org"] = {"Ciclist", "Țară", "Echipă", "Timp", "Puncte", "Clasamentul etapei", "Clasament general", "Clasament pe puncte", "Clasament cățărători", "Clasament sprinteri", "Clasamentul celui mai bun tânăr", "Clasament pe echipe"}
Ред 1.208 ⟶ 1.275:
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"Nom de l'équipe", "Pays", "Code", "WorldTeam", "WorldTeams", "ProTeam", "ProTeams", "Équipe continentale professionnelle", "Équipes continentales professionnelles", "Équipe continentale", "Équipes continentales", "Équipe nationale", "Équipes nationales", "Équipe régionale et de club", "Équipes régionales et de clubs", "Équipe cycliste professionnelle", "Équipes cyclistes professionnelles", "Équipe cycliste amateur", "Équipes cyclistes amateurs", "Groupe sportif I", "Groupes sportifs I", "Groupe sportif II", "Groupes sportifs II", "Groupe sportif III", "Groupes sportifs III", "Équipe mixte", "Équipes mixtes", "Équipe féminine", "Équipes féminines"}
l10nDef["//br.wikipedia.org"] = {"Anv skipailh", "Bro", "Kod", "WorldTeam", "WorldTeams", "ProTeam", "ProTeams", "Skipailh kevandir a-vicher", "Skipailhoù kevandir a-vicher", "Skipailh kevandir", "Skipailhoù kevandir", "Skipailh bro", "Skipailhoù bro", "Skipailh rannvro ha klub", "Skipailhoù rannvro ha club", "Skipailh marc'h-houarn a-vicher", "Skipailhoù marc'h-houarn a-vicher", "Skipailh marc'h-houarn amatour", "Skipailhoù marc'h-houarn amatour", "Strollad sport I", "Strolladoù sport I", "Strollad sport II", "Strolladoù sport II", "Strollad sport III", "Strolladoù sport III", "Skipailh kemmesk", "Skipailhoù kemmesk", "Skipailh merc'hed", "Skipailhoù merc'hed"}
l10nDef["//ca.wikipedia.org"] = {"Nom de l'equip", "País", "Codi", "WorldTeam", "WorldTeams", "ProTeam", "ProTeams", "Equip continental professional", "Equips continentals professionals", "Equip continental", "Equips continentals", "Equip nacional", "Equips nacionals", "Equip regional i de club", "Equips regionals i de clubs", "Equip ciclista professional", "Equips ciclistes professionals", "Equip ciclista amateur", "Equips ciclistes amateurs", "Grup esportiu I", "Grups esportius I", "Grup esportiu II", "Grups esportius II", "Grup esportiu III", "Grups esportius III", "Equip mixt", "Equips mixtos", "Equip femení", "Equips femenins"}
l10nDef["//eo.wikipedia.org"] = {"Nomo de la teamo", "Lando", "Kodo", "Monda teamo", "Mondaj teamoj", "ProTeamo", "ProTeamoj", "Profesiista kontinenta teamo", "Profesiistaj kontinentaj teamoj", "Kontinenta teamo", "Kontinentaj teamoj", "Nacia teamo", "Naciaj teamoj", "Regiona aux kluba teamo", "Regionaj aux klubaj teamoj", "Profesiista bicikla teamo", "Profesiistaj biciklaj teamoj", "Amatora bicikla teamo", "Amatoraj biciklaj teamoj", "Sporta grupo 1", "Sportaj grupoj 1", "Sporta grupo 2", "Sportaj grupoj 2", "Sporta grupo 3", "Sportaj grupoj 3", "Miksa teamo", "Miksaj teamoj", "Ina teamo", "Inaj teamoj"}
l10nDef["//lb.wikipedia.org"] = {"Equippennumm", "Land", "Code", "WorldTeam", "WorldTeams", "ProTeam", "ProTeams", "Professionell Kontinentalequipe", "Professionell Kontinentalequippen", "Kontinentalequipe", "Kontinentalequippen", "Nationalequipe", "Nationalequippen", "Regional- a Klubequipe", "Regional- a Klubequippen", "Professionell Vëlosequipe", "Professionell Vëlosequippen", "Amateursequipe", "Amateursequippen", "Sportsgrupp I", "Sportsgruppen I", "Sportsgrupp II", "Sportsgruppen II", "Sportsgrupp III", "Sportsgruppen III", "Gemëscht Equipe", "Gemëscht Equippen", "Dammenequipe", "Dammenequippen"}
l10nDef["//ro.wikipedia.org"] = {"Numele echipei", "Țară", "Cod", "WorldTeam", "WorldTeams", "ProTeam", "ProTeams", "Echipă continentală profesionistă", "Echipe continentale profesioniste", "Echipă continentală", "Echipe continentale", "Echipă națională", "Echipe naționale", "Echipă regională și de club", "Echipe regionale și de club", "Echipă ciclistă profesionistă", "Echipe cicliste profesioniste", "Echipă ciclistă de amatori", "Echipe cicliste de amatori", "Grup sportiv I", "Grupuri sportive I", "Grup sportiv II", "Grupuri sportive II", "Grup sportiv III", "Grupuri sportive III", "Echipă mixtă", "Echipe mixte", "Echipă feminină", "Echipe feminine"}
Ред 1.225 ⟶ 1.294:
l10nDef["//cs.wikipedia.org"] = {"Ročník", "Vítěz", "Druhý", "Třetí"}
l10nDef["//de.wikipedia.org"] = {"Jahr", "Sieger", "Zweiter", "Dritter"}
l10nDef["//eo.wikipedia.org"] = {"Jaro", "Venkinto", "Dua pozicio", "Tria pozicio"}
l10nDef["//es.wikipedia.org"] = {"Año", "Ganador", "Segundo", "Tercero"}
l10nDef["//eu.wikipedia.org"] = {"Urtea", "Irabazlea", "Bigarrena", "Hirugarrena"}
Ред 1.250 ⟶ 1.320:
-- l10nDef["//.wikipedia.org"] = {plain = "", hilly="", inter='', mount='', time_prologue='', time_team='', time_indiv='', uphill='', rest=''}
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {plain = "étape de plaine", hilly="étape vallonnée", inter='étape de moyenne montagne', mount='étape de montagne', time_prologue='prologue', time_team='contre-la-montre par équipes', time_indiv='contre-la-montre individuel', uphill='contre-la-montre en côte', rest='étape de repos'}
l10nDef["//en.wikipedia.org"] = {plain = "plain stage", hilly="hilly stage", inter='intermediate stage', mount='mountain stage', time_prologue='time trial stage', time_team='team time trial stage', time_indiv='individual time trial stage', uphill='uphill time trial stage', rest='rest day'}
l10nDef["//br.wikipedia.orges"] = {plain = "tennadetapa plaenllana", hilly="tennadetapa digompezescarpada", inter='tennadetapa damveneziekde media montaña', mount='tennadetapa meneziekde montaña', time_prologue='prólogo', time_team='ABEUcontrarreloj a-skipailhoùpor equipos', time_indiv='ABEUcontrarreloj individual', uphill='cronoescalada', rest='devezhjornada de diskuizhdescanso'}
l10nDef["//ca.wikipedia.orgbr"] = {plain = "etapatennad planaplaen", hilly="etapatennad accidentadadigompez", inter='etapatennad de mitja muntanyadamveneziek', mount='etapatennad de muntanyameneziek', time_prologue='pròleg', time_team='contrarellotgeABEU per equipsa-skipailhoù', time_indiv='contrarellotge individualABEU', uphill='', rest='etapa dedevezh descansdiskuizh'}
l10nDef["//cs.wikipedia.orgca"] = {plain = "rovinatá etapa plana", hilly="etapa accidentada", inter='kopcovitá etapa de mitja muntanya', mount='horská etapa de muntanya', time_prologue='prologpròleg', time_team='týmovácontrarellotge časovkaper equips', time_indiv='individuálnícontrarellotge časovkaindividual', uphill='', rest='etapa de descans'}
l10nDef["//de.wikipedia.orgcs"] = {plain = "Flachetapperovinatá etapa", hilly="Hügelige Etappe", inter='Mittelschwerekopcovitá Etappeetapa', mount='Hochgebiergsetappehorská etapa', time_prologue='Prologprolog', time_team='Teamzeitfahrentýmová časovka', time_indiv='Einzelzeitfahrenindividuální časovka', uphill='Bergzeitfahren', rest='Ruhetag'}
l10nDef["//ja.wikipedia.orgeo"] = {plain = "平坦ステージebena etapo", hilly="丘陵ステージmalebena etapo", inter='中間ステージmezgranda montaro etapo', mount='山岳ステージmontara etapo', time_prologue='タイムトライアルステージprologo', time_team='チームタイムトライアルステージteama kontraux-la-kronometro', time_indiv='個人タイムトライアルステージindividua kontraux-la-kronometro', uphill='アップヒルタイムトライアルステージmalebena kontraux-la-kronometro', rest='休養日ripoza etapo'}
l10nDef["//lb.wikipedia.orgde"] = {plain = "Flaach EtappFlachetappe", hilly="HiwwelegHügelige EtappEtappe", inter='MëttelschwéierMittelschwere EtappEtappe', mount='BiergetappHochgebiergsetappe', time_prologue='Prolog', time_team='Contre-la-montre (Equipe)Teamzeitfahren', time_indiv='Contre-la-montre (Eenzel)Einzelzeitfahren', uphill='BiergcourseBergzeitfahren', rest='RoudagRuhetag'}
l10nDef["//lv.wikipedia.orgja"] = {plain = "līdzenuma posms平坦ステージ", hilly="paugurains posms丘陵ステージ", inter='vidēju kalnu posms中間ステージ', mount='kalnu posms山岳ステージ', time_prologue='individuālais brauciensタイムトライアルステージ', time_team='komandu brauciensチームタイムトライアルステージ', time_indiv='individuālais brauciens個人タイムトライアルステージ', uphill='individuālais brauciens kalnāアップヒルタイムトライアルステージ', rest='atpūtas diena休養日'}
l10nDef["//mk.wikipedia.orglb"] = {plain = "рамнаFlaach етапаEtapp", hilly="ридестаHiwweleg етапаEtapp", inter='среднопланинскаMëttelschwéier етапаEtapp', mount='планинска етапаBiergetapp', time_prologue='прологProlog', time_team='екипенContre-la-montre хронометар(Equipe)', time_indiv='индивидуаленContre-la-montre хронометар(Eenzel)', uphill='Biergcourse', rest='ден за одморRoudag'}
l10nDef["//nl.wikipedia.orglv"] = {plain = "vlakkelīdzenuma ritposms", hilly="heuvelritpaugurains posms", inter='heuvelritvidēju kalnu posms', mount='bergritkalnu posms', time_prologue='proloogindividuālais brauciens', time_team='ploegentijdritkomandu brauciens', time_indiv='individueleindividuālais tijdritbrauciens', uphill='klimtijdritindividuālais brauciens kalnā', rest='rustdagatpūtas diena'}
l10nDef["//no.wikipedia.orgmk"] = {plain = "flatрамна etappeетапа", hilly="kupertридеста etappeетапа", inter='middelsсреднопланинска klatreetappeетапа', mount='klatreetappeпланинска етапа', time_prologue='prologпролог', time_team='lagtempoекипен хронометар', time_indiv='temporittиндивидуален хронометар', uphill='klatretempoetappe', rest='hviledagден за одмор'}
l10nDef["//ro.wikipedia.orgnl"] = {plain = "etapăvlakke de platrit", hilly="etapă valonatăheuvelrit", inter='etapă intermediarăheuvelrit', mount='etapă de muntebergrit', time_prologue='prologproloog', time_team='contratimp pe echipeploegentijdrit', time_indiv='contratimpindividuele individualtijdrit', uphill='klimtijdrit', rest='zi de repausrustdag'}
l10nDef["//ru.wikipedia.orgno"] = {plain = "равнинныйflat etappe", hilly="холмистыйkupert etappe", inter='горныйmiddels klatreetappe', mount='высокогорныйklatreetappe', time_prologue='прологprolog', time_team='командная разделкаlagtempo', time_indiv='индивидуальная разделкаtemporitt', uphill='горная разделкаklatretempoetappe', rest='день отдыхаhviledag'}
l10nDef["//www.wikidata.orgpl"] = {plain = "étape de plainepłaski", hilly="étape vallonnée", inter='étape de moyenne montagnepagórkowaty', mount='étape de montagnegórski', time_prologue='prologueprologu', time_team='contre-la-montrejazda pardrużynowa équipesna czas', time_indiv='contre-la-montrejazda individuelindywidualna na czas', uphill='contre-la-montre en côte', rest='étape de repos'}
l10nDef["ro"] = {plain = "etapă de plat", hilly="etapă valonată", inter='etapă intermediară', mount='etapă de munte', time_prologue='prolog', time_team='contratimp pe echipe', time_indiv='contratimp individual', uphill='', rest='zi de repaus'}
local l10n = l10nDef[mw.site.server]
l10nDef["ru"] = {plain = "равнинный", hilly="холмистый", inter='горный', mount='высокогорный', time_prologue='пролог', time_team='командная разделка', time_indiv='индивидуальная разделка', uphill='горная разделка', rest='день отдыха'}
if not l10n then l10n = l10nDef["//fr.wikipedia.org"] end -- default
 
local wiki,l10n=mw.site.server
if wiki=='//www.wikidata.org' then l10n=l10nDef["fr"]
else l10n=l10nDef[string.sub(wiki,string.find(wiki,"%a+"))] end
 
if x=='plain stage' then return "[[File:Plainstage.svg|border|right|20px|"..l10n.plain.."]]" end
local y = ""
if x == 'plainhilly stage' then y =return "[[File:PlainstageHillystage.svg|border|right|20px|" .. l10n.plain hilly.."]]" end
if x == 'hillyintermediate stage' then y =return "[[File:HillystageMediummountainstage.svg|right|border|right|20px|" .. l10n.hilly inter.."]]" end
if x == 'intermediatemountain stage' then y =return "[[File:MediummountainstageMountainstage.svg|border|right|border|20px|" .. l10n.inter mount.."]]" end
if x == 'mountainuphill time trial stage' then y =return "[[File:Mountainstage.svg|border|right|20px|" .. l10n.mount uphill.."]]" end
--if x == 'time trialrest stageday' then y =return "[[File:TimeStage Trialrest day.svg|border|right|20px|" .. l10n.time rest.."]]" end
if x == 'uphill time trial stage' then y = "[[File:Mountainstage.svg|border|right|20px|" .. l10n.uphill .."]]" end
if x typ== 'rest day'2348250 then y =return "[[File:StageTime rest dayTrial.svg|border|right|20px|" .. l10n.rest time_team.."]]" end
if typ==2266066 then return "[[File:Time Trial.svg|right|20px|"..l10n.time_indiv.."]]" end
if x == 'time trial stage' then
if typ ==485321 2348250 then y =return "[[File:Time Trial.svg|right|20px|" .. l10n.time_team time_prologue.."]]" end
if typ == 2266066 then y = "[[File:Time Trial.svg|right|20px|" .. l10n.time_indiv .."]]" end
if typ == 485321 then y = "[[File:Time Trial.svg|right|20px|" .. l10n.time_prologue .."]]" end
end
return y
end
 
Ред 1.297 ⟶ 1.368:
end
 
function flag (x, date)
local year,m,d
_, _, yr, m, d = string.find(date, "(%d+)-(%d+)-(%d+)") -- yr = year, m = month, d = day
if date==nil then date = '+'..os.date('%Y-%m-%d') end
-- yr="1970" for test
-- _,_,year,m,d = string.find(date,"(%d+)-(%d+)-(%d+)") -- year, m = month, d = day
local year = tonumber(yr)
--year="1940"
--x = "Q145"
-- testing if x is the value of p27 (pays de nationalité/country of citizenship) of a person
local flag1 = { -- Q..a current flag, Q..b, Q..c older flag. date: "+2016", "+2016-01-30", ..
if x == 'Q16' then return "[[File:Flag of Canada (Pantone).svg|border|20px|CAN]]" end
if x Q29a== 'Q17' then return {"[[File:Flag of JapanSpain.svg|border|20px|JPNESP]]" end ,"+1982",""},
if x Q29b== 'Q20' then return {"[[File:Flag of NorwaySpain (1977 - 1981).svg|border|20px|NORESP]]" end ,"+1977","+1981"},
if x Q30== 'Q27' then return "[[File:Flag of Irelandthe United States (Pantone).svg|border|20px|IRLUSA]]" end ,
if x Q31== 'Q28' then return "[[File:Flag of HungaryBelgium (civil).svg|border|20px|HUNBEL]]" end ,
if x Q38a== 'Q29' then if year >= 1977 and year <= 1981 then return {"[[File:Flag of Spain (1977 - 1981)Italy.svg|border|20px|ESPITA]]" end ,"+1947",""},
return Q38b={"[[File:Flag of SpainItaly (1861-1946) crowned.svg|border|20px|ESPITA]]" end ,"+1861","+1946"},
if x Q39== 'Q30' then return "[[File:Flag of the United StatesSwitzerland (Pantone).svg|border|20px15px|USASUI]]" end ,
if x Q55== 'Q31' then return "[[File:Flag of Belgiumthe (civil)Netherlands.svg|border|20px|BELNED]]" end ,
if x Q142== 'Q32' then return "[[File:Flag of LuxembourgFrance.svg|border|20px|LUXFRA]]" end ,
if x Q145== 'Q33' then return "[[File:Flag of Finlandthe United Kingdom.svg|border|20px|FINGBR]]" end ,
if x Q183== 'Q34' then return "[[File:Flag of SwedenGermany.svg|border|20px|SWEGER]]" end ,
if x Q218a== 'Q35' then return {"[[File:Flag of DenmarkRomania.svg|border|20px|DENROU]]" end ,"+1989-12-27",""},
if x Q218b== 'Q36' then return {"[[File:Flag of PolandRomania (1965-1989).svg|border|20px|POLROU]]" end ,"+1965","+1989-12-26"},
if x Q218c== 'Q37' then return {"[[File:Flag of LithuaniaRomania (1952-1965).svg|border|20px|LTUROU]]" end ,"+1952","+1965"},
if x Q218d== 'Q38' then if year >= 1861 and year <= 1946 then return {"[[File:Flag of ItalyRomania (18611948-19461952) crowned.svg|border|20px|ITAROU]]" end ,"+1948","+1952"},
return Q218e={"[[File:Flag of ItalyRomania.svg|border|20px|ITAROU]]" end ,"+1867-07-01","+1948"}
}
if x == 'Q39' then return "[[File:Flag of Switzerland (Pantone).svg|border|15px|SUI]]" end
 
if x == 'Q40' then return "[[File:Flag of Austria.svg|border|20px|AUT]]" end
if flag1[x..'a']~=nil and date>==flag1[x..'a'][2] and flag1[x..'a'][3]=='Q41' then return "flag1[[File:Flag of Greecex.svg|border|20px|GRE.'a'][1]" end
if flag1[x..'b']~=nil and date>==flag1[x..'b'][2] and date<=flag1[x..'Q43b'][3] then return "flag1[[File:Flag of Turkeyx.svg|border|20px|TUR.'b'][1]" end
if flag1[x..'c']~=nil and date>==flag1[x..'c'][2] and date<=flag1[x..'Q45c'][3] then return "flag1[[File:Flag of Portugalx.svg|border|20px|POR.'c'][1]" end
if flag1[x..'d']~=nil and date>=flag1[x..'d'][2] and date<=flag1[x..'d'][3] then return flag1[x..'d'][1] end
if x == 'Q55' then return "[[File:Flag of the Netherlands.svg|border|20px|NED]]" end
if flag1[x..'e']~=nil and date>==flag1[x..'e'][2] and date<=flag1[x..'Q77e'][3] then return "flag1[[File:Flag of Uruguayx.svg|border|20px|URU.'e'][1]" end
if flag1[x ]~== 'Q79'nil then return "flag1[[File:Flag of Egypt.svg|border|20px|EGY]x]" end
 
if x == 'Q96' then return "[[File:Flag of Mexico.svg|border|20px|MEX]]" end
local flag2 = { Q16={'Q80110','CAN'}, Q17={'Q43175','JPN'}, Q20={'Q83149','NOR'}, Q27={'Q82205','IRL'}, Q35={'Q60149','DEN'}, Q36={'Q42436','POL'},
if x == 'Q114' then return "[[File:Flag of Kenya.svg|border|20px|KEN]]" end
Q37={'Q81477','LTU'}, Q39={'Q124020','SUI'}, Q77={'Q171103','URU'}, Q145={'Q83278','GBR'}, Q159={'Q16611','RUS'}, Q191={'Q81471','EST'}, Q211={'Q130449','LAT'},
if x == 'Q115' then return "[[File:Flag of Ethiopia.svg|border|20px|ETH]]" end
Q212={'Q127974','UKR'}, Q214={'Q160861','SVK'}, Q232={'Q131650','KAZ'}, Q408={'Q81676','AUS'}, Q739={'Q160425','COL'} }
if x == 'Q117' then return "[[File:Flag of Ghana.svg|border|20px|GHA]]" end
 
if x == 'Q142' then return "[[File:Flag of France.svg|border|20px|FRA]]" end
if flag2[x]~=nil then x = flag2[x] end -- transform x to new x
if x == 'Q145' then return "[[File:Flag of the United Kingdom.svg|border|20px|GBR]]" end
if type(x)=='table' and pcall(foo1,x[1]) then -- for transformed x
if x == 'Q148' then return "[[File:Flag of the People's Republic of China.svg|border|20px|CHN]]" end
local entity=mw.wikibase.getEntity(x[1])
if x == 'Q155' then return "[[File:Flag of Brazil.svg|border|20px|BRA]]" end
local a,b=pcall(fooA,'value',entity,'P18',1) -- P18 (image)
if x == 'Q159' then return "[[File:Flag of Russia.svg|border|20px|RUS]]" end
if x a== 'Q176'true then return "[[File:Flag of Quebec".svg.b.."|border|20px|"..x[2].."]]" end
end
if x == 'Q183' then return "[[File:Flag of Germany.svg|border|20px|GER]]" end
if type(x)=='string' and pcall(foo1,x) then -- reading the flag data from untransformed items, e.g. Q29
if x == 'Q184' then return "[[File:Flag of Belarus.svg|border|20px|BLR]]" end
local entity = mw.wikibase.getEntity( x )
if x == 'Q189' then return "[[File:Flag of Iceland.svg|border|20px|ISL]]" end
local flags = entity.claims["P41"]
if x == 'Q191' then return "[[File:Flag of Estonia.svg|border|20px|EST]]" end
local possible_flag = {}
if x == 'Q211' then return "[[File:Flag of Latvia.svg|border|20px|LAT]]" end
local num = 1
if x == 'Q212' then return "[[File:Flag of Ukraine.svg|border|20px|UKR]]" end
for _, v in pairs(flags) do
if x == 'Q213' then return "[[File:Flag of the Czech Republic.svg|border|20px|CZE]]" end
if v.qualifiers then
if x == 'Q214' then return "[[File:Flag of Slovakia.svg|border|20px|SVK]]" end
if (not v.qualifiers["P580"] or v.qualifiers["P580"][1].datavalue.value.time <= date)
if x == 'Q215' then return "[[File:Flag of Slovenia.svg|border|20px|SLO]]" end
and (not v.qualifiers["P582"] or v.qualifiers["P582"][1].datavalue.value.time >= date)
if x == 'Q217' then return "[[File:Flag of Moldova.svg|border|20px|MDA]]" end
then possible_flag[num]=v.mainsnak.datavalue.value num=num+1 end
if x == 'Q218' then return "[[File:Flag of Romania.svg|border|20px|ROU]]" end
else possible_flag[num]=v.mainsnak.datavalue.value num=num+1 end
if x == 'Q219' then return "[[File:Flag of Bulgaria.svg|border|20px|BUL]]" end
end
if x == 'Q221' then return "[[File:Flag of Macedonia.svg|border|20px|MKD]]" end
if x local file== 'Q222' then return "[[File:Flag of Albania".svg.possible_flag[1].."|border|20px|ALB]]" end
local a2,b2=pcall(fooA,'value',entity,'P984',1) -- P984 (country code by the International Olympic Committee)
if x == 'Q224' then return "[[File:Flag of Croatia.svg|border|20px|CRO]]" end
if x a2== 'Q225'true then return file=file.."|"..b2.."]]"[[File:Flag of Bosniaelse and Herzegovinafile=file.svg|border|20px|BIH."]]" end
return file
if x == 'Q227' then return "[[File:Flag of Azerbaijan.svg|border|20px|AZE]]" end
end
if x == 'Q228' then return "[[File:Flag of Andorra.svg|border|20px|AND]]" end
return " "
if x == 'Q229' then return "[[File:Flag of Cyprus (1960-2006).svg|border|20px|CYP]]" end
end
if x == 'Q230' then return "[[File:Flag of Georgia.svg|border|20px|GEO]]" end
if x == 'Q232' then return "[[File:Flag of Kazakhstan.svg|border|20px|KAZ]]" end
if x == 'Q233' then return "[[File:Flag of Malta.svg|border|20px|MLT]]" end
if x == 'Q235' then return "[[File:Flag of Monaco.svg|border|20px|MON]]" end
if x == 'Q236' then return "[[File:Flag of Montenegro.svg|border|20px|MNE]]" end
if x == 'Q237' then return "[[File:Flag of the Vatican City.svg|border|15px|VAT]]" end
if x == 'Q238' then return "[[File:Flag of San Marino.svg|border|20px|SMR]]" end
if x == 'Q241' then return "[[File:Flag of Cuba.svg|border|20px|CUB]]" end
if x == 'Q242' then return "[[File:Flag of Belize.svg|border|20px|BIZ]]" end
if x == 'Q244' then return "[[File:Flag of Barbados.svg|border|20px|BAR]]" end
if x == 'Q252' then return "[[File:Flag of Indonesia.svg|border|20px|INA]]" end
if x == 'Q258' then return "[[File:Flag of South Africa.svg|border|20px|RSA]]" end
if x == 'Q262' then return "[[File:Flag of Algeria.svg|border|20px|ALG]]" end
if x == 'Q265' then return "[[File:Flag of Uzbekistan.svg|border|20px|UZB]]" end
if x == 'Q298' then return "[[File:Flag of Chile.svg|border|20px|CHI]]" end
if x == 'Q334' then return "[[File:Flag of Singapore.svg|border|20px|SIN]]" end
if x == 'Q347' then return "[[File:Flag of Liechtenstein.svg|border|20px|LIE]]" end
if x == 'Q398' then return "[[File:Flag of Bahrain.svg|border|20px|BRN]]" end
if x == 'Q399' then return "[[File:Flag of Armenia.svg|border|20px|ARM]]" end
if x == 'Q403' then return "[[File:Flag of Serbia.svg|border|20px|SRB]]" end
if x == 'Q408' then return "[[File:Flag of Australia (converted).svg|border|20px|AUS]]" end
if x == 'Q414' then return "[[File:Flag of Argentina.svg|border|20px|ARG]]" end
if x == 'Q419' then return "[[File:Flag of Peru.svg|border|20px|PER]]" end
if x == 'Q423' then return "[[File:Flag of North Korea.svg|border|20px|PRK]]" end
if x == 'Q424' then return "[[File:Flag of Cambodia.svg|border|20px|CAM]]" end
if x == 'Q574' then return "[[File:Flag of East Timor.svg|border|20px|TLS]]" end
if x == 'Q657' then return "[[File:Flag of Chad.svg|border|20px|CHA]]" end
if x == 'Q664' then return "[[File:Flag of New Zealand.svg|border|20px|NZL]]" end
if x == 'Q668' then return "[[File:Flag of India.svg|border|20px|IND]]" end
if x == 'Q672' then return "[[File:Flag of Tuvalu.svg|border|20px|TUV]]" end
if x == 'Q678' then return "[[File:Flag of Tonga.svg|border|20px|TGA]]" end
if x == 'Q683' then return "[[File:Flag of Samoa.svg|border|20px|SAM]]" end
if x == 'Q685' then return "[[File:Flag of the Solomon Islands.svg|border|20px|SOL]]" end
if x == 'Q686' then return "[[File:Flag of Vanuatu.svg|border|20px|VAN]]" end
if x == 'Q691' then return "[[File:Flag of Papua New Guinea.svg|border|20px|PNG]]" end
if x == 'Q695' then return "[[File:Flag of Palau.svg|border|20px|PLW]]" end
if x == 'Q697' then return "[[File:Flag of Nauru.svg|border|20px|NRU]]" end
if x == 'Q702' then return "[[File:Flag of the Federated States of Micronesia.svg|border|20px|FSM]]" end
if x == 'Q709' then return "[[File:Flag of the Marshall Islands.svg|border|20px|MHL]]" end
if x == 'Q710' then return "[[File:Flag of Kiribati.svg|border|20px|KIR]]" end
if x == 'Q711' then return "[[File:Flag of Mongolia.svg|border|20px|MGL]]" end
if x == 'Q712' then return "[[File:Flag of Fiji.svg|border|20px|FIJ]]" end
if x == 'Q717' then return "[[File:Flag of Venezuela.svg|border|20px|VEN]]" end
if x == 'Q730' then return "[[File:Flag of Suriname.svg|border|20px|SUR]]" end
if x == 'Q733' then return "[[File:Flag of Paraguay.svg|border|20px|PAR]]" end
if x == 'Q734' then return "[[File:Flag of Guyana.svg|border|20px|GUY]]" end
if x == 'Q736' then return "[[File:Flag of Ecuador.svg|border|20px|ECU]]" end
if x == 'Q739' then return "[[File:Flag of Colombia.svg|border|20px|COL]]" end
if x == 'Q750' then return "[[File:Flag of Bolivia (state).svg|border|20px|BOL]]" end
if x == 'Q754' then return "[[File:Flag of Trinidad and Tobago.svg|border|20px|TTO]]" end
if x == 'Q757' then return "[[File:Flag of Saint Vincent and the Grenadines.svg|border|20px|VIN]]" end
if x == 'Q760' then return "[[File:Flag of Saint Lucia.svg|border|20px|LCA]]" end
if x == 'Q763' then return "[[File:Flag of Saint Kitts and Nevis.svg|border|20px|SKN]]" end
if x == 'Q766' then return "[[File:Flag of Jamaica.svg|border|20px|JAM]]" end
if x == 'Q769' then return "[[File:Flag of Grenada.svg|border|20px|GRN]]" end
if x == 'Q774' then return "[[File:Flag of Guatemala.svg|border|20px|GUA]]" end
if x == 'Q778' then return "[[File:Flag of the Bahamas.svg|border|20px|BAH]]" end
if x == 'Q781' then return "[[File:Flag of Antigua and Barbuda.svg|border|20px|ANT]]" end
if x == 'Q783' then return "[[File:Flag of Honduras.svg|border|20px|HON]]" end
if x == 'Q784' then return "[[File:Flag of Dominica.svg|border|20px|DMA]]" end
if x == 'Q786' then return "[[File:Flag of the Dominican Republic.svg|border|20px|DOM]]" end
if x == 'Q790' then return "[[File:Flag of Haiti.svg|border|20px|HAI]]" end
if x == 'Q792' then return "[[File:Flag of El Salvador.svg|border|20px|ESA]]" end
if x == 'Q794' then return "[[File:Flag of Iran.svg|border|20px|IRI]]" end
if x == 'Q796' then return "[[File:Flag of Iraq.svg|border|20px|IRQ]]" end
if x == 'Q800' then return "[[File:Flag of Costa Rica.svg|border|20px|CRC]]" end
if x == 'Q801' then return "[[File:Flag of Israel.svg|border|20px|ISR]]" end
if x == 'Q804' then return "[[File:Flag of Panama.svg|border|20px|PAN]]" end
if x == 'Q805' then return "[[File:Flag of Yemen.svg|border|20px|YEM]]" end
if x == 'Q810' then return "[[File:Flag of Jordan.svg|border|20px|JOR]]" end
if x == 'Q811' then return "[[File:Flag of Nicaragua.svg|border|20px|NCA]]" end
if x == 'Q813' then return "[[File:Flag of Kyrgyzstan.svg|border|20px|KGZ]]" end
if x == 'Q817' then return "[[File:Flag of Kuwait.svg|border|20px|KUW]]" end
if x == 'Q819' then return "[[File:Flag of Laos.svg|border|20px|LAO]]" end
if x == 'Q822' then return "[[File:Flag of Lebanon.svg|border|20px|LIB]]" end
if x == 'Q826' then return "[[File:Flag of Maldives.svg|border|20px|MDV]]" end
if x == 'Q833' then return "[[File:Flag of Malaysia.svg|border|20px|MAS]]" end
if x == 'Q836' then return "[[File:Flag of Myanmar.svg|border|20px|MYA]]" end
if x == 'Q837' then return "[[File:Flag of Nepal.svg|15px|NEP]]" end
if x == 'Q842' then return "[[File:Flag of Oman.svg|border|20px|OMA]]" end
if x == 'Q843' then return "[[File:Flag of Pakistan.svg|border|20px|PAK]]" end
if x == 'Q846' then return "[[File:Flag of Qatar.svg|border|20px|QAT]]" end
if x == 'Q851' then return "[[File:Flag of Saudi Arabia.svg|border|20px|KSA]]" end
if x == 'Q854' then return "[[File:Flag of Sri Lanka.svg|border|20px|SRI]]" end
if x == 'Q858' then return "[[File:Flag of Syria.svg|border|20px|SYR]]" end
if x == 'Q863' then return "[[File:Flag of Tajikistan.svg|border|20px|TJK]]" end
if x == 'Q865' then return "[[File:Flag of the Republic of China.svg|border|20px|TPE]]" end
if x == 'Q869' then return "[[File:Flag of Thailand.svg|border|20px|THA]]" end
if x == 'Q874' then return "[[File:Flag of Turkmenistan.svg|border|20px|THM]]" end
if x == 'Q878' then return "[[File:Flag of the United Arab Emirates.svg|border|20px|UAE]]" end
if x == 'Q881' then return "[[File:Flag of Vietnam.svg|border|20px|VIE]]" end
if x == 'Q884' then return "[[File:Flag of South Korea.svg|border|20px|KOR]]" end
if x == 'Q889' then return "[[File:Flag of Afghanistan.svg|border|20px|AFG]]" end
if x == 'Q902' then return "[[File:Flag of Bangladesh.svg|border|20px|BAN]]" end
if x == 'Q912' then return "[[File:Flag of Mali.svg|border|20px|MLI]]" end
if x == 'Q916' then return "[[File:Flag of Angola.svg|border|20px|ANG]]" end
if x == 'Q917' then return "[[File:Flag of Bhutan.svg|border|20px|BHU]]" end
if x == 'Q921' then return "[[File:Flag of Brunei.svg|border|20px|BRU]]" end
if x == 'Q924' then return "[[File:Flag of Tanzania.svg|border|20px|TAN]]" end
if x == 'Q928' then return "[[File:Flag of the Philippines.svg|border|20px|PHI]]" end
if x == 'Q929' then return "[[File:Flag of the Central African Republic.svg|border|20px|CAF]]" end
if x == 'Q945' then return "[[File:Flag of Togo.svg|border|20px|TOG]]" end
if x == 'Q948' then return "[[File:Flag of Tunisia.svg|border|20px|TUN]]" end
if x == 'Q953' then return "[[File:Flag of Zambia.svg|border|20px|ZAM]]" end
if x == 'Q954' then return "[[File:Flag of Zimbabwe.svg|border|20px|ZIM]]" end
if x == 'Q958' then return "[[File:Flag of South Sudan.svg|border|20px|SSD]]" end
if x == 'Q962' then return "[[File:Flag of Benin.svg|border|20px|BEN]]" end
if x == 'Q963' then return "[[File:Flag of Botswana.svg|border|20px|BOT]]" end
if x == 'Q965' then return "[[File:Flag of Burkina Faso.svg|border|20px|BUR]]" end
if x == 'Q967' then return "[[File:Flag of Burundi.svg|border|20px|BDI]]" end
if x == 'Q970' then return "[[File:Flag of the Comoros.svg|border|20px|COM]]" end
if x == 'Q971' then return "[[File:Flag of the Republic of the Congo.svg|border|20px|CGO]]" end
if x == 'Q974' then return "[[File:Flag of the Democratic Republic of the Congo.svg|border|20px|COD]]" end
if x == 'Q977' then return "[[File:Flag of Djibouti.svg|border|20px|DJI]]" end
if x == 'Q983' then return "[[File:Flag of Equatorial Guinea.svg|border|20px|GEQ]]" end
if x == 'Q986' then return "[[File:Flag of Eritrea.svg|border|20px|ERI]]" end
if x == 'Q1000' then return "[[File:Flag of Gabon.svg|border|20px|GAB]]" end
if x == 'Q1005' then return "[[File:Flag of The Gambia.svg|border|20px|GAM]]" end
if x == 'Q1006' then return "[[File:Flag of Guinea.svg|border|20px|GUI]]" end
if x == 'Q1007' then return "[[File:Flag of Guinea-Bissau.svg|border|20px|GBS]]" end
if x == 'Q1008' then return "[[File:Flag of Côte d'Ivoire.svg|border|20px|CIV]]" end
if x == 'Q1009' then return "[[File:Flag of Cameroon.svg|border|20px|CMR]]" end
if x == 'Q1011' then return "[[File:Flag of Cape Verde.svg|border|20px|CPV]]" end
if x == 'Q1013' then return "[[File:Flag of Lesotho.svg|border|20px|LES]]" end
if x == 'Q1014' then return "[[File:Flag of Liberia.svg|border|20px|LBR]]" end
if x == 'Q1016' then return "[[File:Flag of Libya (1951).svg|border|20px|LBA]]" end
if x == 'Q1019' then return "[[File:Flag of Madagascar.svg|border|20px|MAD]]" end
if x == 'Q1020' then return "[[File:Flag of Malawi.svg|border|20px|MAW]]" end
if x == 'Q1025' then return "[[File:Flag of Mauritania.svg|border|20px|MTN]]" end
if x == 'Q1027' then return "[[File:Flag of Mauritius.svg|border|20px|MRI]]" end
if x == 'Q1028' then return "[[File:Flag of Morocco.svg|border|20px|MAR]]" end
if x == 'Q1029' then return "[[File:Flag of Mozambique.svg|border|20px|MOZ]]" end
if x == 'Q1030' then return "[[File:Flag of Namibia.svg|border|20px|NAM]]" end
if x == 'Q1032' then return "[[File:Flag of Niger.svg|border|20px|NIG]]" end
if x == 'Q1033' then return "[[File:Flag of Nigeria.svg|border|20px|NGR]]" end
if x == 'Q1036' then return "[[File:Flag of Uganda.svg|border|20px|UGA]]" end
if x == 'Q1037' then return "[[File:Flag of Rwanda.svg|border|20px|RWA]]" end
if x == 'Q1039' then return "[[File:Flag of Sao Tome and Principe.svg|border|20px|STP]]" end
if x == 'Q1041' then return "[[File:Flag of Senegal.svg|border|20px|SEN]]" end
if x == 'Q1042' then return "[[File:Flag of Seychelles.svg|border|20px|SEY]]" end
if x == 'Q1044' then return "[[File:Flag of Sierra Leone.svg|border|20px|SLE]]" end
if x == 'Q1045' then return "[[File:Flag of Somalia.svg|border|20px|SOM]]" end
if x == 'Q1049' then return "[[File:Flag of Sudan.svg|border|20px|SUD]]" end
if x == 'Q1050' then return "[[File:Flag of Swaziland.svg|border|20px|SWZ]]" end
if x == 'Q1246' then return "[[File:Flag of Kosovo.svg|border|20px|KOS]]" end
if x == 'Q8646' then return "[[File:Flag of Hong Kong.svg|border|20px|HKG]]" end
if x == 'Q15180' then return "[[File:Flag of the Soviet Union.svg|border|20px|URS]]" end
if x == 'Q16957' then return "[[File:Flag of East Germany.svg|border|20px|GDR]]" end
if x == 'Q26988' then return "[[File:Flag of the Cook Islands.svg|border|20px|COK]]" end
if x == 'Q28513' then return "[[File:Flag of Austria-Hungary (1869-1918).svg|border|20px]]" end
if x == 'Q33946' then return "[[File:Flag of the Czech Republic.svg|border|20px|TCH]]" end
if x == 'Q34020' then return "[[File:Flag of Niue.svg|border|20px]]" end
if x == 'Q34266' then return "[[File:Flag of Russia.svg|border|20px|RU1]]" end
if x == 'Q36704' then return "[[File:Flag of SFR Yugoslavia.svg|border|20px|YUG]]" end
return ""
end
 
return p