Modul:Cycling race
Das Modul Cycling race ist ein in Lua geschriebenes Programm und gehört zum Wikidata:WikiProjekt Radsport. Das Modul übernimmt nur Daten aus der Wikidata; mit Hilfe entsprechender Vorlagen werden diese Inhalte in einer Tabelle, Infobox, o. Ä. dargestellt und dürfen für die Wikipedia-Artikel verwendet werden. Das Modul selbst wird ebenso als Module:Cycling race auf Wikidata bereitgestellt, wo der entsprechende Quelltext von der Community weiterentwickelt wird. Der Code wird in regelmäßigen Abständen aktualisiert. Das Modul steht für alle Sprachversionen der Wikipedia zur Verfügung.
Allgemeine Hinweise
Es wird empfohlen, dass jede Verbesserung des Moduls bzw. des Codes zunächst auf der entsprechenden Hauptseite erfolgen soll. Verbesserungsvorschläge, Wünsche oder Fehlermeldungen sollen ebenso auf der Diskussionsseite des Moduls (in englischer Sprache) eingereicht und besprochen werden.
Sämtliche Updates auf der Wikidata-Hauptseite können 1:1 für die deutschsprachige Wikipedia-Seite übernommen werden. Nach dem Update wird empfohlen, die Vorlagen auf ihre vollständige Funktion zu überprüfen. Der Inhalt des Quellcodes darf nicht umgenannt werden.
Vorlagen
Vorlage | Beschreibung | Kopiervorlage |
---|---|---|
Vorlage:Cycling race/bestyoungclassification | Nachwuchswertung (Zeit) | {{Cycling race/bestyoungclassification|Wikidata-ID}} |
Vorlage:Cycling race/bestyoungclassificationbypoints | Nachwuchswertung (Punkte) | {{Cycling race/bestyoungclassificationbypoints|Wikidata-ID}} |
Vorlage:Cycling race/calendar | Rennkalender (inkl. Ergebnis) für UCI-Rennserien | {{Cycling race/calendar|Kürzel|Jahr}} |
Vorlage:Cycling race/combinationclassification | Kombinationswertung | {{Cycling race/combinationclassification|Wikidata-ID}} |
Vorlage:Cycling race/combativeclassification | Kämpferischster Fahrer | {{Cycling race/combativeclassification|Wikidata-ID}} |
Vorlage:Cycling race/custompointsclassification | Titelname ändern (Punkteklassements) | {{Cycling race/custompointsclassification|Wikidata-ID|p=Pxxxx|t=Titelname}} |
Vorlage:Cycling race/generalclassification | Gesamtwertung (Zeit) | {{Cycling race/generalclassification|Wikidata-ID}} |
Vorlage:Cycling race/infobox | Infobox (für jeweilige Ausgabe einer Rundfahrt & eines Eintagesrennen; nicht für Etappen und Radrennen im Allgemeinen) | {{Cycling race/infobox|Wikidata-ID}} |
Vorlage:Cycling race/listofstages | Etappenliste | {{Cycling race/listofstages|Wikidata-ID}} |
Vorlage:Cycling race/listofstagesclassification | Wertungen im Tourverlauf | {{Cycling race/listofstagesclassification|Wikidata-ID}} |
Vorlage:Cycling race/listofteams | Übersicht teilnehmender Teams bei Rundfahrt & Eintagesrennen | {{Cycling race/listofteams|Wikidata-ID}} |
Vorlage:Cycling race/listofwinners | Siegerliste (Rundfahrt und Eintagesrennen; Platz 1 bis 3 je Ausgabe) | {{Cycling race/listofwinners|Wikidata-ID}} |
Vorlage:Cycling race/mountainsclassification | Bergwertung | {{Cycling race/mountainsclassification|Wikidata-ID}} |
Vorlage:Cycling race/pointsclassification | Punktewertung | {{Cycling race/pointsclassification|Wikidata-ID}} |
Vorlage:Cycling race/raceinfobox | Infobox (Radrennen im Allgemeinen) | {{Cycling race/raceinfobox|Wikidata-ID}} |
Vorlage:Cycling race/sprintsclassification | Sprintwertung im Zwischensprint | {{Cycling race/sprintsclassification|Wikidata-ID}} |
Vorlage:Cycling race/stageclassification | Etappenergebnis (Zeit) | {{Cycling race/stageclassification|Wikidata-ID}} |
Vorlage:Cycling race/stageinfobox | Infobox (Etappen) | {{Cycling race/stageinfobox|Wikidata-ID}} |
Vorlage:Cycling race/stagetitle | Etappentitel (Start und Ziel, Etappenprofil und Streckenlänge) | {{Cycling race/stagetitle|Wikidata-ID}} |
Vorlage:Cycling race/startlist | Fahrerfeld/Startliste (Rundfahrt & Eintagesrennen) | {{Cycling race/startlist|Wikidata-ID}} |
Vorlage:Cycling race/teamranking | Bestplatzierung eines Teams (inkl. bester Fahrer) in einer UCI-Radrennserie | {{Cycling race/teamranking|Wikidata-ID|Kürzel}} |
Vorlage:Cycling race/teamriderCompetitionranking | Bestplatzierung in einer vordefinierten UCI-Radrennserie in einer Saison | {{Cycling race/teamriderCompetitionranking|Wikidata-ID|Kürzel}} |
Vorlage:Cycling race/teamsclassificationbytime | Mannschaftswertung (Zeit) | {{Cycling race/teamsclassificationbytime|Wikidata-ID}} |
Vorlage:Cycling race/teamsclassificationbypoints | Mannschaftswertung (Punkte) | {{Cycling race/teamsclassificationbypoints|Wikidata-ID}} |
Vorlage:Cycling race/teamtimetrialclassification | Etappenergebnis (nur bei Teamzeitfahren) | {{Cycling race/teamtimetrialclassification|Wikidata-ID}} |
Vorlage:Cycling race/teamroster | Übersicht Teamkader | {{Cycling race/teamroster|Wikidata-ID}} |
Vorlage:Cycling race/UCIclassification | UCI-Rangliste in einer Saison (Team) | {{Cycling race/UCIclassification|Wikidata-ID}} |
Vorlage:Cycling race/victories | Siegerliste (Team) | {{Cycling race/victories|Wikidata-ID}} |
Übersetzung der Vorlagen
- Für die deutschsprachige Begriffe (in Tabelle, Infobox, etc.): Modul:Cycling race/l10n
- Für die deutschsprachige Begriffe in der Wikidata: Wikidata:WikiProject Cycling/Kit to translate
- Für die deutschsprachige Bezeichnung der Länder: Modul:Cycling race/lang
- Für die deutschsprachige Bezeichnung der Wertungstrikots: Wikidata:WikiProject Cycling/Kit to translate/Jerseys
- Für die deutschsprachige Bezeichnung der Nationalteams: Wikidata:WikiProject Cycling/Kit to translate/National teams
Saisons im UCI-Kalender und Grand Tours (inkl. Wertungstrikots)
- Für die Verknüpfung in den entsprechendenden Tabellen: Modul:Cycling race/data
local p = {}
function p.listofstages(frame)
local i, v, uu, ii
local etape = {}
local entity = {}
local series_ordinal, point_of_time, length = {}, {}, {}
local sitelinks1, sitelinks2, sitelinks3, sitelinks4 = {}, {}, {}, {}
local y, m, d = {}, {}, {}
local flag1, flag2 = {}, {}
local number0, number1, number2 = {}, {}, {}
local stage = {}
local level = 1
entity0 = mw.wikibase.getEntityObject( frame.args[1] ) -- Q18589873 (Quatre jours de Dunkerque 2015)
-- begin level 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>", 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 = {}
while level == 2 and entity0.claims["P527"][num] do
etape[num] = 'Q'..entity0.claims["P527"][num].mainsnak.datavalue.value['numeric-id']
entity[num] = mw.wikibase.getEntityObject( etape[num] )
if pcall(function ()
if unexpected_condition then error() end
series_ordinal[num] = entity[num].claims["P1545"][1].mainsnak.datavalue.value
end
) then else series_ordinal[num] = " " end
table.insert(parts, num, {nr = series_ordinal[num], Qnum = etape[num]})
num = num + 1
end
-- sort parts after nr = series_ordinal[num], not Qnum
table.sort(parts, function(a, b)
local num1 = string.sub(a.nr, string.find(a.nr, "%d+"))
local num2 = string.sub(b.nr, string.find(b.nr, "%d+"))
local char1, char2
if string.find(a.nr, "%a") then char1 = string.sub(a.nr, string.find(a.nr, "%a")) else char1 = "" end
if string.find(b.nr, "%a") then char2 = string.sub(b.nr, string.find(b.nr, "%a")) else char2 = "" end
local comp
if char1 == "" and char2 == "" then comp = tonumber(num1) < tonumber(num2) end
if char1 ~= "" and char2 == "" then comp = tonumber(num1) < tonumber(num2) end
if char1 == "" and char2 ~= "" then comp = tonumber(num1) < tonumber(num2) end
if char1 ~= "" and char2 ~= "" then comp = char1 < char2 end
return comp end)
--return a.nr < b.nr end)
num = 1
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 )
number0[num] = " [[File:Wikidata-logo S.svg|12px|link=d:" .. parts[num].Qnum .. "]]"
if pcall(function ()
if unexpected_condition then error() end
series_ordinal[num] = entity[num].claims["P1545"][1].mainsnak.datavalue.value
end
) then else series_ordinal[num] = " " end
if pcall(function()
if unexpected_condition then error() end
point_of_time[num] = entity[num].claims["P585"][1].mainsnak.datavalue.value.time
end
) then else point_of_time[num] = " " end
if pcall(function()
if unexpected_condition then error() end
sitelinks1[num] = mw.wikibase.sitelink( 'Q'..entity[num].claims["P1427"][1].mainsnak.datavalue.value['numeric-id'] )
sitelinks1[num] = "[[" .. sitelinks1[num] .. "|" .. string.gsub(sitelinks1[num], "%b()", "") .. "]]"
end
) then else
if pcall(function()
if unexpected_condition then error() end
sitelinks1[num] = mw.wikibase.label( 'Q'..entity[num].claims["P1427"][1].mainsnak.datavalue.value['numeric-id'] )
sitelinks1[num] = "[[" .. sitelinks1[num] .. "]]"
end
) then else sitelinks1[num] = "n.v." end
end
if pcall(function()
if unexpected_condition then error() end
sitelinks2[num] = mw.wikibase.sitelink( 'Q'..entity[num].claims["P1444"][1].mainsnak.datavalue.value['numeric-id'] )
sitelinks2[num] = "[[" .. sitelinks2[num] .. "|" .. string.gsub(sitelinks2[num], "%b()", "") .. "]]"
end
) then else
if pcall(function()
if unexpected_condition then error() end
sitelinks2[num] = mw.wikibase.label( 'Q'..entity[num].claims["P1444"][1].mainsnak.datavalue.value['numeric-id'] )
sitelinks2[num] = "[[" .. sitelinks2[num] .. "]]"
end
) then else sitelinks2[num] = "n.v." end
end
if pcall(function() -- string.sub cuts of the first character, a plus sign, from the entity-part
if unexpected_condition then error() end
length[num] = string.sub( entity[num].claims["P2043"][1].mainsnak.datavalue.value.amount, 2, -1)
end
) then else length[num] = " " end
-- find the vainqueur d'étape, Q20882747
i = 1
sitelinks3[num] = "" -- "unknown3"
number1[num] = ""
flag1[num] = ""
if pcall(function()
if unexpected_condition then error() end
local t = entity[num].claims["P1346"][i] -- error or no error?
end
) then -- t: no error
while entity[num].claims["P1346"][i] do
if pcall(function()
if unexpected_condition then error() end
local t = entity[num].claims["P1346"][i].qualifiers.P642[1].datavalue.value['numeric-id']
end
) then -- t: no error
if entity[num].claims["P1346"][i].qualifiers.P642[1].datavalue.value['numeric-id'] == 20882747 then
number1[num] = 'Q'..entity[num].claims["P1346"][i].mainsnak.datavalue.value['numeric-id']
if pcall(function()
if unexpected_condition then error() end
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
--sitelinks3[num] = " [[" .. mw.wikibase.sitelink(number1[num]) .. "]]"
if pcall(function() -- find name of winner
if unexpected_condition then error() end
sitelinks3[num] = " [[" .. mw.wikibase.sitelink(number1[num]) .. " |" .. string.gsub(mw.wikibase.sitelink(number1[num]), "%b()", "") .. "]]"
end
) then else sitelinks3[num] = " [[" .. mw.wikibase.label(number1[num]) .. "]]" end
number1[num] = " [[File:Wikidata-logo S.svg|12px|link=d:" .. 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
if unexpected_condition then error() end
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()
if unexpected_condition then error() end
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] = " [[File:Wikidata-logo S.svg|12px|link=d:" .. 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
-- find the leader du classement général à l'issue de l'étape, Q20882763
i = 1
sitelinks4[num] = "" --"unknown4"
number2[num] = ""
flag2[num] = ""
if pcall(function()
if unexpected_condition then error() end
local t = entity[num].claims["P1346"][i] -- error or no error?
end
) then -- t: no error
while entity[num].claims["P1346"][i] do
if pcall(function()
if unexpected_condition then error() end
local t = entity[num].claims["P1346"][i].qualifiers.P642[1].datavalue.value['numeric-id']
end
) then -- t: no error
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
number2[num] = 'Q'..entity[num].claims["P1346"][i].mainsnak.datavalue.value['numeric-id']
if pcall(function()
if unexpected_condition then error() end
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
--sitelinks4[num] = " [[" .. mw.wikibase.sitelink(number2[num]) .. "]]"
if pcall(function() -- find name of winner
if unexpected_condition then error() end
sitelinks4[num] = " [[" .. mw.wikibase.sitelink(number2[num]) .. "|" .. string.gsub(mw.wikibase.sitelink(number2[num]), "%b()", "") .. "]]"
end
) then else sitelinks4[num] = " [[" .. mw.wikibase.label(number2[num]) .. "]]" end
number2[num] = " [[File:Wikidata-logo S.svg|12px|link=d:" .. 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
if unexpected_condition then error() end
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()
if unexpected_condition then error() end
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] = " [[File:Wikidata-logo S.svg|12px|link=d:" .. 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()
if unexpected_condition then error() end
-- find the type of stages
i = 1
stage[num] = ""
uu = entity[num].claims["P31"][i].mainsnak.datavalue.value['numeric-id']
while entity[num].claims["P31"][i] do
if uu == 20646667 then stage[num] = typeofstage('plain stage') end
if uu == 20646670 then stage[num] = typeofstage('hilly stage') end
if uu == 20680270 then stage[num] = typeofstage('intermediate stage') end
if uu == 20646668 then stage[num] = typeofstage('mountain stage') end
if uu == 485321 then stage[num] = typeofstage('time trial stage', 485321) end -- prologue
if uu == 2266066 then stage[num] = typeofstage('time trial stage', 2266066) end -- individual time trial
if uu == 2348250 then stage[num] = typeofstage('time trial stage', 2348250) end -- team time trial
if uu == 20679712 then stage[num] = typeofstage('uphill time trial stage') end
i = i + 1
end
end
) then else stage[num] = " " end
if pcall(function()
if unexpected_condition then error() end
-- 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()
if unexpected_condition then error() end
local official_name = mw.wikibase.getEntity( number ).claims["P1448"][1].mainsnak.datavalue.value.text
sitelinks3[num] = string.sub(string.gsub(sitelinks3[num], "%b|]", "") , 0, -3).."|"..official_name.."]]"
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
num = num + 1
end -- end while loop 1
-- build table for output
local table_center = ""
for var=1, num-1 do
local a, b
a, _ = string.gsub(series_ordinal[var], "%a", "") -- 20, not 20a
if string.find(series_ordinal[var], "%a") then b = string.sub(series_ordinal[var], string.find(series_ordinal[var], "%a"))
else b = "" end
local ee, er = wikilinks(series_ordinal[var], a, b)
if series_ordinal[var] == "0" then
er = "#"..func_prologue()
ee = func_prologue()
end
local day = tostring(tonumber(d[var]))
if day == "1" then day = "1<sup>er</sup>" end
local month = func_month(m[var])
table_center = table_center.."<tr style='vertical-align:top'><td style='text-align:right'>".."[["..er.."|"..ee.."]]"..number0[var]
table_center = table_center.."</td><td style='text-align:right; padding-right:0px'>"..day.."</td><td>"..month
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
return table_first .. table.concat(table_proto) .. table_center .. table_last
end
function func_prologue() -- returns the word "Prologue"
local translDef = { ["//www.wikidata.org"] = "Prologue",
["//fr.wikipedia.org"] = "Prologue",
["//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",
["//la.wikipedia.org"] = "Incipit prologus",
["//lv.wikipedia.org"] = "Prologs",
["//mk.wikipedia.org"] = "Пролог",
["//nl.wikipedia.org"] = "Proloog",
["//no.wikipedia.org"] = "Prolog",
["//pl.wikipedia.org"] = "Prologu",
["//pt.wikipedia.org"] = "Prólogo",
["//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
function wikilinks(x, a, b) -- x= 10a: a = 10, b = a. x = 5: a = 5, b = ""
local translDef = { ["//www.wikidata.org"] = "étape",
["//fr.wikipedia.org"] = "étape",
["//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",
["//la.wikipedia.org"] = "statio",
["//lv.wikipedia.org"] = "posms",
["//mk.wikipedia.org"] = "Етапа",
["//nl.wikipedia.org"] = "etappe",
["//no.wikipedia.org"] = "etappe",
["//pl.wikipedia.org"] = "etap",
["//pt.wikipedia.org"] = "etapa",
["//ru.wikipedia.org"] = "этап",
["//sk.wikipedia.org"] = "etapa",
["//sv.wikipedia.org"] = "etapp" }
local word = translDef[mw.site.server]
local word1, word2
if not word then
word2 = translDef["//fr.wikipedia.org"] -- default
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,
if a == "1" then word2 = "#1re "..word else word2 = "#"..a.."e "..word end --text of section header = #1re étape, #2e étape
return word1, word2
end
if b ~= "" then -- series_ordinal with character: instead of eg "1a re" it is "1re a"
if a == "1" then word1 = "1<sup>re</sup> "..b.." "..word else word1 = a.."<sup>e</sup> "..b.." "..word end -- table text = {{1re}} étape, {{2ae}} étape,
if a == "1" then word2 = "#1re "..b.." "..word else word2 = "#"..a.."e"..b.." "..word end --text of section header = #1re étape, #2e étape
return word1, word2
end
end
-- default
word1 = x -- table text = 1, 2a, 3
word2 = "#"..word.." ".. x -- text of section header = #Etappe 2a, #Stage 4
--return table text, text of section header
return word1, word2
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"] = {"Jan.", "Feb.", "Mar.", "Apr.", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."}
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["//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"] = {"Jän.", "Feb.", "März", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sept.", "Okt.", "Nov.", "Dez."}
l10nDef["//es.wikipedia.org"] = {"enero", "feb.", "marzo", "abr.", "mayo", "jun.", "jul.", "agosto", "sept.", "oct.", "nov.", "dic."}
l10nDef["//et.wikipedia.org"] = {"jaan.", "veebr.", "märts", "apr.", "mai", "juuni", "juuli", "aug.", "sept.", "okt.", "nov.", "dets."}
l10nDef["//hu.wikipedia.org"] = {"jan.", "feb.", "márc.", "ápr.", "máj.", "jun.", "jul.", "aug.", "szept.", "okt.", "nov.", "dec."}
l10nDef["//id.wikipedia.org"] = {"Djan.", "Peb.", "Mrt.", "Apr.", "Mai", "Djuni", "Djuli", "Ag.", "Sept.", "Okt.", "Nop.", "Des."}
l10nDef["//it.wikipedia.org"] = {"genn.", "febbr.", "mar.", "apr.", "magg.", "giugno", "luglio", "ag.", "sett.", "ott.", "nov.", "dic."}
l10nDef["//la.wikipedia.org"] = {"Ian.", "Febr.", "Mart.", "Apr.", "Mai.", "Iun.", "Iul.", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."}
l10nDef["//lt.wikipedia.org"] = {"saus.", "vas.", "kovas", "bal.", "geg.", "birz", "liepa", "rugp.", "rugs.", "spalis", "lapkr.", "gr."}
l10nDef["//lv.wikipedia.org"] = {"jan.", "feb.", "marts", "apr.", "maijs", "junijs", "julijs", "aug.", "sept.", "okt.", "nov.", "dec."}
l10nDef["//mk.wikipedia.org"] = {"јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"}
l10nDef["//ms.wikipedia.org"] = {"Jan.", "Feb.", "Mac", "Apr.", "Mei", "Jun", "Julai", "Og", "Sept.", "Okt.", "Nov.", "Dis."}
l10nDef["//no.wikipedia.org"] = {"jan.", "febr.", "mars", "april", "mai", "juni", "juli", "aug.", "sept.", "okt.", "nov.", "des."}
l10nDef["//nl.wikipedia.org"] = {"jan.", "feb.", "maart", "apr.", "mei", "juni", "juli", "aug.", "sept.", "okt.", "nov.", "dec."}
l10nDef["//pl.wikipedia.org"] = {"stycz.", "luty", "mar.", "kwiec.", "maj", "czerw.", "lip.", "sierp.", "wrzes.", "pazdz.", "listop.", "grudz."}
l10nDef["//pt.wikipedia.org"] = {"jan.", "fev.", "março", "abril", "maio", "junho", "julho", "agosto", "set.", "out.", "nov.", "dez."}
l10nDef["//ro.wikipedia.org"] = {"Ian", "Feb.", "Mar.", "Apr.", "Mai", "Iunie", "Iulie", "Aug.", "Sept.", "Oct.", "Noem.", "Dec."}
l10nDef["//sh.wikipedia.org"] = {"sijec.", "velj.", "ozuj.", "trav.", "svib.", "lip.", "srp.", "kol.", "ruj.", "list.", "stud.", "pros."}
l10nDef["//sk.wikipedia.org"] = {"l'ad.", "ún.", "brez.", "dub.", "kvet", "cerv.", "cerven.", "srp.", "zári.", "ruj.", "list.", "pros."}
l10nDef["//sl.wikipedia.org"] = {"jan.", "feb.", "mar.", "apr.", "maj", "jun.", "jul.", "avg.", "sept.", "okt.", "nov.", "dec."}
l10nDef["//sv.wikipedia.org"] = {"jan.", "febr.", "mars", "april", "maj", "juni", "juli", "aug.", "sept.", "okt.", "nov.", "dec."}
local l10n = l10nDef[mw.site.server]
if not l10n then
l10n = l10nDef["//fr.wikipedia.org"] -- default
end
return l10n[tonumber(x)]
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.org"] = {"Etapa", "Fecha", "Recorrido", "Distancia (km)", "Ganador", "Líder"}
l10nDef["//fi.wikipedia.org"] = {"Etappi", "Päivä", "Reitti", "Pituus (km)", "Voittaja", "Yleinen johtaja"}
l10nDef["//hu.wikipedia.org"] = {"Szakasz", "Időpont", "Végpontok", "Hossz (km)", "Szakaszgyőztes", "Általános vezető"}
l10nDef["//it.wikipedia.org"] = {"Tappa", "Data", "Percorso", "Distanza (km)", "Vincitore di tappa", "Leader cl. generale"}
l10nDef["//la.wikipedia.org"] = {"Statio", "Dies", "Iter", "Distantia (km)", "Victor", "Altiore princeps"}
l10nDef["//lv.wikipedia.org"] = {"Posms", "Datums", "Maršruts", "Posma garums (km)", "Uzvarētājs", "Kopējais līderis"}
l10nDef["//mk.wikipedia.org"] = {"Етапа", "Датум", "Тек", "Растојание (км)", "Победник", "Cевкупен лидер"}
l10nDef["//nl.wikipedia.org"] = {"Etappe", "Datum", "Start – Finish", "Afstand (km)", "Winnaar", "Klassementsleider"}
l10nDef["//no.wikipedia.org"] = {"Etappe", "Dato", "Start – Målgang", "Lengde (km)", "Etappevinner", "Ordnet leder"}
l10nDef["//pl.wikipedia.org"] = {"Etap", "Data", "Start – Meta", "Dystans (km)", "Zwycięzca etapu", "Lider"}
l10nDef["//pt.wikipedia.org"] = {"Etapa", "Data", "Percurso", "Distância (km)", "Vencedor", "Líder geral"}
l10nDef["//ru.wikipedia.org"] = {"Этап", "Дата", "Маршрут", "Длина (km)", "Победитель", "Aбсолютным лидером"}
l10nDef["//sk.wikipedia.org"] = {"Etapa", "Dátum", "Trasa", "Vzdialenosť (km)", "Víťaz", "Priebežný líder"}
l10nDef["//sv.wikipedia.org"] = {"Etapp", "Datum", "Start – mål", "Distans (km)", "Skede vinnare", "Övergripande ledare"}
l10nDef["//als.wikipedia.org"] = l10nDef["//de.wikipedia.org" ]
l10nDef["//www.wikidata.org"] = {"Étape", "Date", "Villes étapes", "Dist. (km)", "Vainqueur d'étape", "Leader du classement général"}
local l10n = l10nDef[mw.site.server]
if not l10n then
l10n = l10nDef["//fr.wikipedia.org"] -- default
end
return l10n[x]
end
function headoftableII(x) -- En-tête du tableau du classement général
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"Classement général", "Coureur", "Pays", "Équipe", "Temps"}
l10nDef["//www.wikidata.org"] = {"Classement général", "Coureur", "Pays", "Équipe", "Temps"}
local l10n = l10nDef[mw.site.server]
if not l10n then
l10n = l10nDef["//fr.wikipedia.org"] -- default
end
return l10n[x]
end
function headoftableIII(x) -- En-tête du tableau du classement d'une étape
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"Classement de l'étape", "Coureur", "Pays", "Équipe", "Temps"}
l10nDef["//www.wikidata.org"] = {"Classement de l'étape", "Coureur", "Pays", "Équipe", "Temps"}
local l10n = l10nDef[mw.site.server]
if not l10n then
l10n = l10nDef["//fr.wikipedia.org"] -- default
end
return l10n[x]
end
function headoftableIV(x) -- En-tête du tableau du palmarès d'une course cycliste
-- l10nDef["//.wikipedia.org"] = {"", "", "", ""}
local l10nDef = { }
l10nDef["//fr.wikipedia.org"] = {"Année", "Vainqueur", "Deuxième", "Troisième"}
l10nDef["//en.wikipedia.org"] = {"Year", "Winner", "Second", "Third"}
l10nDef["//br.wikipedia.org"] = {"Bloavezh", "1añ", "2l", "3de"}
l10nDef["//ca.wikipedia.org"] = {"Any", "Vencedor", "Segon", "Tercer"}
l10nDef["//de.wikipedia.org"] = {"Jahr", "Sieger", "Zweiter", "Dritter"}
l10nDef["//es.wikipedia.org"] = {"Año", "Ganador", "Segundo", "Tercero"}
l10nDef["//eu.wikipedia.org"] = {"Urtea", "Irabazlea", "Bigarrena", "Hirugarrena"}
l10nDef["//hu.wikipedia.org"] = {"Év", "Versenyző", "Második", "Harmadik"}
l10nDef["//it.wikipedia.org"] = {"Anno", "Vincitore", "Secondo", "Terzo"}
l10nDef["//lv.wikipedia.org"] = {"Gads", "Braucējs", "Otrais", "Trešais"}
l10nDef["//mk.wikipedia.org"] = {"Година", "Возач", "Вториот", "Трети"}
l10nDef["//nl.wikipedia.org"] = {"Jaar", "Winnaar", "Tweede", "Derde"}
l10nDef["//no.wikipedia.org"] = {"År", "Vinnere", "Second", "Tredje"}
l10nDef["//pl.wikipedia.org"] = {"Rok", "Pierwsze", "Drugie", "Trzecie"}
l10nDef["//pt.wikipedia.org"] = {"Ano", "Vencedor", "Segundo", "Terceiro"}
l10nDef["//ru.wikipedia.org"] = {"Год", "Победитель", "Второй", "Третья"}
l10nDef["//sr.wikipedia.org"] = {"Година", "Победник", "Други", "Трећи"}
l10nDef["//www.wikidata.org"] = {"Année", "Vainqueur", "Deuxième", "Troisième"}
local l10n = l10nDef[mw.site.server]
if not l10n then
l10n = l10nDef["//fr.wikipedia.org"] -- default
end
return l10n[x]
end
function typeofstage(x, typ)
-- plain, hilly, inter, ... must be "" or "any text"
-- 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.org"] = {plain = "tennad plaen", hilly="tennad digompez", inter='tennad damveneziek', mount='tennad meneziek', time_prologue='', time_team='ABEU a-skipailhoù', time_indiv='ABEU', uphill='', rest='devezh diskuizh'}
l10nDef["//mk.wikipedia.org"] = {plain = "рамна етапа", hilly="ридеста етапа", inter='среднопланинска етапа', mount='планинска етапа', time_prologue='пролог', time_team='екипен хронометар', time_indiv='индивидуален хронометар', uphill='', rest='ден за одмор'}
l10nDef["//nl.wikipedia.org"] = {plain = "vlakke rit", hilly="heuvelrit", inter='heuvelrit', mount='bergrit', time_prologue='proloog', time_team='ploegentijdrit', time_indiv='individuele tijdrit', uphill='klimtijdrit', rest='rustdag'}
l10nDef["//www.wikidata.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'}
local l10n = l10nDef[mw.site.server]
if not l10n then
l10n = l10nDef["//fr.wikipedia.org"] -- default
end
local y = ""
if x == 'plain stage' then y = "[[File:Plainstage.svg|border|right|20px|" .. l10n.plain .."]]" end
if x == 'hilly stage' then y = "[[File:Hillystage.svg|border|right|20px|" .. l10n.hilly .."]]" end
if x == 'intermediate stage' then y = "[[File:Mediummountainstage.svg|right|border|20px|" .. l10n.inter .."]]" end
if x == 'mountain stage' then y = "[[File:Mountainstage.svg|border|right|20px|" .. l10n.mount .."]]" end
--if x == 'time trial stage' then y = "[[File:Time Trial.svg|right|20px|" .. l10n.time .."]]" end
if x == 'uphill time trial stage' then y = "[[File:Mountainstage.svg|border|right|20px|" .. l10n.uphill .."]]" end
if x == 'rest day' then y = "[[File:Stage rest day.svg|border|right|20px|" .. l10n.rest .."]]" end
if x == 'time trial stage' then
if typ == 2348250 then y = "[[File:Time Trial.svg|right|20px|" .. l10n.time_team .."]]" 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
function flag (x, date)
_, _, yr, m, d = string.find(date, "(%d+)-(%d+)-(%d+)") -- yr = year, m = month, d = day
-- yr="1970" for test
local year = tonumber(yr)
local y = ""
-- testing if x is the value of p27 (pays de nationalité/country of citizenship) of a person
if x == 'Q16' then y = "[[File:Flag of Canada (Pantone).svg|border|20px|CAN]]" return y end -- Q16 = Canada
if x == 'Q17' then y = "[[File:Flag of Japan.svg|border|20px|JPN]]" return y end -- Q17 = Japon
if x == 'Q20' then y = "[[File:Flag of Norway.svg|border|20px|NOR]]" return y end -- Q20 = Norvège
if x == 'Q27' then y = "[[File:Flag of Ireland.svg|border|20px|IRL]]" return y end -- Q27 = Irlande
if x == 'Q28' then y = "[[File:Flag of Hungary.svg|border|20px|HUN]]" return y end -- Q28 = Hongrie
if x == 'Q29' then if year >= 1977 and year <= 1981 then return "[[File:Flag of Spain (1977 - 1981).svg|border|20px|ESP]]" end y = "[[File:Flag of Spain.svg|border|20px|ESP]]" return y end -- Q29 = Espagne
if x == 'Q30' then y = "[[File:Flag of the United States (Pantone).svg|border|20px|USA]]" return y end -- Q30 = États-Unis
if x == 'Q31' then y = "[[File:Flag of Belgium (civil).svg|border|20px|BEL]]" return y end -- Q31 = Belgique
if x == 'Q32' then y = "[[File:Flag of Luxembourg.svg|border|20px|LUX]]" return y end -- Q32 = Luxembourg
if x == 'Q33' then y = "[[File:Flag of Finland.svg|border|20px|FIN]]" return y end -- Q33 = Finlande
if x == 'Q34' then y = "[[File:Flag of Sweden.svg|border|20px|SWE]]" return y end -- Q34 = Suède
if x == 'Q35' then y = "[[File:Flag of Denmark.svg|border|20px|DEN]]" return y end -- Q35 = Danemark
if x == 'Q36' then y = "[[File:Flag of Poland.svg|border|20px|POL]]" return y end -- Q36 = Pologne
if x == 'Q37' then y = "[[File:Flag of Lithuania.svg|border|20px|LTU]]" return y end -- Q37 = Lituanie
if x == 'Q38' then y = "[[File:Flag of Italy.svg|border|20px|ITA]]" return y end -- Q38 = Italie
if x == 'Q39' then y = "[[File:Flag of Switzerland (Pantone).svg|border|15px|SUI]]" return y end -- Q39 = Suisse
if x == 'Q40' then y = "[[File:Flag of Austria.svg|border|20px|AUT]]" return y end -- Q40 = Autriche
if x == 'Q41' then y = "[[File:Flag of Greece.svg|border|20px|GRE]]" return y end -- Q41 = Grèce
if x == 'Q43' then y = "[[File:Flag of Turkey.svg|border|20px|TUR]]" return y end -- Q43 = Turquie
if x == 'Q45' then y = "[[File:Flag of Portugal.svg|border|20px|POR]]" return y end -- Q45 = Portugal
if x == 'Q55' then y = "[[File:Flag of the Netherlands.svg|border|20px|NED]]" return y end -- Q55 = Pays-Bas
if x == 'Q77' then y = "[[File:Flag of Uruguay.svg|border|20px|URU]]" return y end -- Q77 = Uruguay
if x == 'Q79' then y = "[[File:Flag of Egypt.svg|border|20px|EGY]]" return y end -- Q79 = Égypte
if x == 'Q96' then y = "[[File:Flag of Mexico.svg|border|20px|MEX]]" return y end -- Q96 = Mexique
if x == 'Q114' then y = "[[File:Flag of Kenya.svg|border|20px|KEN]]" return y end -- Q114 = Kenya
if x == 'Q115' then y = "[[File:Flag of Ethiopia.svg|border|20px|ETH]]" return y end -- Q115 = Éthiopie
if x == 'Q117' then y = "[[File:Flag of Ghana.svg|border|20px|GHA]]" return y end -- Q117 = Ghana
if x == 'Q142' then y = "[[File:Flag of France.svg|border|20px|FRA]]" return y end -- Q142 = France
if x == 'Q145' then y = "[[File:Flag of the United Kingdom.svg|border|20px|GBR]]" return y end -- Q145 = Royaume-uni
if x == 'Q148' then y = "[[File:Flag of the People's Republic of China.svg|border|20px|CHN]]" return y end -- Q148 = Chine
if x == 'Q155' then y = "[[File:Flag of Brazil.svg|border|20px|BRA]]" return y end -- Q155 = Brésil
if x == 'Q159' then y = "[[File:Flag of Russia.svg|border|20px|RUS]]" return y end -- Q159 = Russie
if x == 'Q176' then y = "[[File:Flag of Quebec.svg|border|20px]]" return y end -- Q176 = Québec
if x == 'Q183' then y = "[[File:Flag of Germany.svg|border|20px|GER]]" return y end -- Q183 = Allemagne
if x == 'Q184' then y = "[[File:Flag of Belarus.svg|border|20px|BLR]]" return y end -- Q184 = Biélorussie
if x == 'Q189' then y = "[[File:Flag of Iceland.svg|border|20px|ISL]]" return y end -- Q189 = Islande
if x == 'Q191' then y = "[[File:Flag of Estonia.svg|border|20px|EST]]" return y end -- Q191 = Estonie
if x == 'Q211' then y = "[[File:Flag of Latvia.svg|border|20px|LAT]]" return y end -- Q211 = Lettonie
if x == 'Q212' then y = "[[File:Flag of Ukraine.svg|border|20px|UKR]]" return y end -- Q212 = Ukraine
if x == 'Q213' then y = "[[File:Flag of the Czech Republic.svg|border|20px|CZE]]" return y end -- Q213 = République tchèque
if x == 'Q214' then y = "[[File:Flag of Slovakia.svg|border|20px|SVK]]" return y end -- Q214 = Slovaquie
if x == 'Q215' then y = "[[File:Flag of Slovenia.svg|border|20px|SLO]]" return y end -- Q215 = Slovénie
if x == 'Q217' then y = "[[File:Flag of Moldova.svg|border|20px|MDA]]" return y end -- Q217 = Moldavie
if x == 'Q218' then y = "[[File:Flag of Romania.svg|border|20px|ROU]]" return y end -- Q218 = Roumanie
if x == 'Q219' then y = "[[File:Flag of Bulgaria.svg|border|20px|BUL]]" return y end -- Q219 = Bulgarie
if x == 'Q221' then y = "[[File:Flag of Macedonia.svg|border|20px|MKD]]" return y end -- Q221 = Macédoine
if x == 'Q222' then y = "[[File:Flag of Albania.svg|border|20px|ALB]]" return y end -- Q222 = Albanie
if x == 'Q224' then y = "[[File:Flag of Croatia.svg|border|20px|CRO]]" return y end -- Q224 = Croatie
if x == 'Q225' then y = "[[File:Flag of Bosnia and Herzegovina.svg|border|20px|BIH]]" return y end -- Q225 = Bosnie-Herzégovine
if x == 'Q227' then y = "[[File:Flag of Azerbaijan.svg|border|20px|AZE]]" return y end -- Q227 = Azerbaïdjan
if x == 'Q228' then y = "[[File:Flag of Andorra.svg|border|20px|AND]]" return y end -- Q228 = Andorre
if x == 'Q229' then y = "[[File:Flag of Cyprus (1960-2006).svg|border|20px|CYP]]" return y end -- Q229 = Chypre
if x == 'Q230' then y = "[[File:Flag of Georgia.svg|border|20px|GEO]]" return y end -- Q230 = Géorgie
if x == 'Q232' then y = "[[File:Flag of Kazakhstan.svg|border|20px|KAZ]]" return y end -- Q232 = Kazakhstan
if x == 'Q233' then y = "[[File:Flag of Malta.svg|border|20px|MLT]]" return y end -- Q233 = Malte
if x == 'Q235' then y = "[[File:Flag of Monaco.svg|border|20px|MON]]" return y end -- Q235 = Monaco
if x == 'Q236' then y = "[[File:Flag of Montenegro.svg|border|20px|MNE]]" return y end -- Q236 = Monténégro
if x == 'Q237' then y = "[[File:Flag of the Vatican City.svg|border|15px|VAT]]" return y end -- Q237 = Vatican
if x == 'Q238' then y = "[[File:Flag of San Marino.svg|border|20px|SMR]]" return y end -- Q238 = Saint-Marin
if x == 'Q241' then y = "[[File:Flag of Cuba.svg|border|20px|CUB]]" return y end -- Q241 = Cuba
if x == 'Q242' then y = "[[File:Flag of Belize.svg|border|20px|BIZ]]" return y end -- Q242 = Belize
if x == 'Q244' then y = "[[File:Flag of Barbados.svg|border|20px|BAR]]" return y end -- Q244 = Barbade
if x == 'Q252' then y = "[[File:Flag of Indonesia.svg|border|20px|INA]]" return y end -- Q252 = Indonésie
if x == 'Q258' then y = "[[File:Flag of South Africa.svg|border|20px|RSA]]" return y end -- Q258 = Afrique du Sud
if x == 'Q262' then y = "[[File:Flag of Algeria.svg|border|20px|ALG]]" return y end -- Q262 = Algérie
if x == 'Q265' then y = "[[File:Flag of Uzbekistan.svg|border|20px|UZB]]" return y end -- Q265 = Ouzbékistan
if x == 'Q298' then y = "[[File:Flag of Chile.svg|border|20px|CHI]]" return y end -- Q298 = Chili
if x == 'Q334' then y = "[[File:Flag of Singapore.svg|border|20px|SIN]]" return y end -- Q334 = Singapour
if x == 'Q347' then y = "[[File:Flag of Liechtenstein.svg|border|20px|LIE]]" return y end -- Q347 = Liechtenstein
if x == 'Q398' then y = "[[File:Flag of Bahrain.svg|border|20px|BRN]]" return y end -- Q398 = Bahreïn
if x == 'Q399' then y = "[[File:Flag of Armenia.svg|border|20px|ARM]]" return y end -- Q399 = Arménie
if x == 'Q403' then y = "[[File:Flag of Serbia.svg|border|20px|SRB]]" return y end -- Q403 = Serbie
if x == 'Q408' then y = "[[File:Flag of Australia (converted).svg|border|20px|AUS]]" return y end -- Q408 = Australie
if x == 'Q414' then y = "[[File:Flag of Argentina.svg|border|20px|ARG]]" return y end -- Q414 = Argentine
if x == 'Q419' then y = "[[File:Flag of Peru.svg|border|20px|PER]]" return y end -- Q419 = Pérou
if x == 'Q423' then y = "[[File:Flag of North Korea.svg|border|20px|PRK]]" return y end -- Q423 = Corée du Nord
if x == 'Q424' then y = "[[File:Flag of Cambodia.svg|border|20px|CAM]]" return y end -- Q424 = Cambodge
if x == 'Q574' then y = "[[File:Flag of East Timor.svg|border|20px|TLS]]" return y end -- Q574 = Timor oriental
if x == 'Q657' then y = "[[File:Flag of Chad.svg|border|20px|CHA]]" return y end -- Q657 = Tchad
if x == 'Q664' then y = "[[File:Flag of New Zealand.svg|border|20px|NZL]]" return y end -- Q664 = Nouvelle-Zélande
if x == 'Q668' then y = "[[File:Flag of India.svg|border|20px|IND]]" return y end -- Q668 = Inde
if x == 'Q672' then y = "[[File:Flag of Tuvalu.svg|border|20px|TUV]]" return y end -- Q672 = Tuvalu
if x == 'Q678' then y = "[[File:Flag of Tonga.svg|border|20px|TGA]]" return y end -- Q678 = Tonga
if x == 'Q683' then y = "[[File:Flag of Samoa.svg|border|20px|SAM]]" return y end -- Q683 = Samoa
if x == 'Q685' then y = "[[File:Flag of the Solomon Islands.svg|border|20px|SOL]]" return y end -- Q685 = Salomon
if x == 'Q686' then y = "[[File:Flag of Vanuatu.svg|border|20px|VAN]]" return y end -- Q686 = Vanuatu
if x == 'Q691' then y = "[[File:Flag of Papua New Guinea.svg|border|20px|PNG]]" return y end -- Q691 = Papouasie-Nouvelle-Guinée
if x == 'Q695' then y = "[[File:Flag of Palau.svg|border|20px|PLW]]" return y end -- Q695 = Palaos
if x == 'Q697' then y = "[[File:Flag of Nauru.svg|border|20px|NRU]]" return y end -- Q697 = Nauru
if x == 'Q702' then y = "[[File:Flag of the Federated States of Micronesia.svg|border|20px|FSM]]" return y end -- Q702 = Micronésie
if x == 'Q709' then y = "[[File:Flag of the Marshall Islands.svg|border|20px|MHL]]" return y end -- Q709 = Îles Marshall
if x == 'Q710' then y = "[[File:Flag of Kiribati.svg|border|20px|KIR]]" return y end -- Q710 = Kiribati
if x == 'Q711' then y = "[[File:Flag of Mongolia.svg|border|20px|MGL]]" return y end -- Q711 = Mongolie
if x == 'Q712' then y = "[[File:Flag of Fiji.svg|border|20px|FIJ]]" return y end -- Q712 = Fidji
if x == 'Q717' then y = "[[File:Flag of Venezuela.svg|border|20px|VEN]]" return y end -- Q717 = Venezuela
if x == 'Q730' then y = "[[File:Flag of Suriname.svg|border|20px|SUR]]" return y end -- Q730 = Suriname
if x == 'Q733' then y = "[[File:Flag of Paraguay.svg|border|20px|PAR]]" return y end -- Q733 = Paraguay
if x == 'Q734' then y = "[[File:Flag of Guyana.svg|border|20px|GUY]]" return y end -- Q734 = Guyana
if x == 'Q736' then y = "[[File:Flag of Ecuador.svg|border|20px|ECU]]" return y end -- Q736 = Équateur
if x == 'Q739' then y = "[[File:Flag of Colombia.svg|border|20px|COL]]" return y end -- Q739 = Colombie
if x == 'Q750' then y = "[[File:Flag of Bolivia (state).svg|border|20px|BOL]]" return y end -- Q750 = Bolivie
if x == 'Q754' then y = "[[File:Flag of Trinidad and Tobago.svg|border|20px|TTO]]" return y end -- Q754 = Trinité-et-Tobago
if x == 'Q757' then y = "[[File:Flag of Saint Vincent and the Grenadines.svg|border|20px|VIN]]" return y end -- Q757 = Saint-Vincent-et-les-Grenadines
if x == 'Q760' then y = "[[File:Flag of Saint Lucia.svg|border|20px|LCA]]" return y end -- Q760 = Sainte-Lucie
if x == 'Q763' then y = "[[File:Flag of Saint Kitts and Nevis.svg|border|20px|SKN]]" return y end -- Q763 = Saint-Christophe-et-Niévès
if x == 'Q766' then y = "[[File:Flag of Jamaica.svg|border|20px|JAM]]" return y end -- Q766 = Jamaïque
if x == 'Q769' then y = "[[File:Flag of Grenada.svg|border|20px|GRN]]" return y end -- Q769 = Grenade
if x == 'Q774' then y = "[[File:Flag of Guatemala.svg|border|20px|GUA]]" return y end -- Q774 = Guatemala
if x == 'Q778' then y = "[[File:Flag of the Bahamas.svg|border|20px|BAH]]" return y end -- Q778 = Bahamas
if x == 'Q781' then y = "[[File:Flag of Antigua and Barbuda.svg|border|20px|ANT]]" return y end -- Q781 = Antigua-et-Barbuda
if x == 'Q783' then y = "[[File:Flag of Honduras.svg|border|20px|HON]]" return y end -- Q783 = Honduras
if x == 'Q784' then y = "[[File:Flag of Dominica.svg|border|20px|DMA]]" return y end -- Q784 = Dominique
if x == 'Q786' then y = "[[File:Flag of the Dominican Republic.svg|border|20px|DOM]]" return y end -- Q786 = République dominicaine
if x == 'Q790' then y = "[[File:Flag of Haiti.svg|border|20px|HAI]]" return y end -- Q790 = Haïti
if x == 'Q792' then y = "[[File:Flag of El Salvador.svg|border|20px|ESA]]" return y end -- Q792 = Salvador
if x == 'Q794' then y = "[[File:Flag of Iran.svg|border|20px|IRI]]" return y end -- Q794 = Iran
if x == 'Q796' then y = "[[File:Flag of Iraq.svg|border|20px|IRQ]]" return y end -- Q796 = Irak
if x == 'Q800' then y = "[[File:Flag of Costa Rica.svg|border|20px|CRC]]" return y end -- Q800 = Costa Rica
if x == 'Q801' then y = "[[File:Flag of Israel.svg|border|20px|ISR]]" return y end -- Q801 = Israël
if x == 'Q804' then y = "[[File:Flag of Panama.svg|border|20px|PAN]]" return y end -- Q804 = Panama
if x == 'Q805' then y = "[[File:Flag of Yemen.svg|border|20px|YEM]]" return y end -- Q805 = Yémen
if x == 'Q810' then y = "[[File:Flag of Jordan.svg|border|20px|JOR]]" return y end -- Q810 = Jordanie
if x == 'Q811' then y = "[[File:Flag of Nicaragua.svg|border|20px|NCA]]" return y end -- Q811 = Nicaragua
if x == 'Q813' then y = "[[File:Flag of Kyrgyzstan.svg|border|20px|KGZ]]" return y end -- Q813 = Kirghizistan
if x == 'Q817' then y = "[[File:Flag of Kuwait.svg|border|20px|KUW]]" return y end -- Q817 = Koweït
if x == 'Q819' then y = "[[File:Flag of Laos.svg|border|20px|LAO]]" return y end -- Q819 = Laos
if x == 'Q822' then y = "[[File:Flag of Lebanon.svg|border|20px|LIB]]" return y end -- Q822 = Liban
if x == 'Q826' then y = "[[File:Flag of Maldives.svg|border|20px|MDV]]" return y end -- Q826 = Maldives
if x == 'Q833' then y = "[[File:Flag of Malaysia.svg|border|20px|MAS]]" return y end -- Q833 = Malaisie
if x == 'Q836' then y = "[[File:Flag of Myanmar.svg|border|20px|MYA]]" return y end -- Q836 = Birmanie
if x == 'Q837' then y = "[[File:Flag of Nepal.svg|15px|NEP]]" return y end -- Q837 = Népal
if x == 'Q842' then y = "[[File:Flag of Oman.svg|border|20px|OMA]]" return y end -- Q842 = Oman
if x == 'Q843' then y = "[[File:Flag of Pakistan.svg|border|20px|PAK]]" return y end -- Q843 = Pakistan
if x == 'Q846' then y = "[[File:Flag of Qatar.svg|border|20px|QAT]]" return y end -- Q846 = Qatar
if x == 'Q851' then y = "[[File:Flag of Saudi Arabia.svg|border|20px|KSA]]" return y end -- Q851 = Arabie saoudite
if x == 'Q854' then y = "[[File:Flag of Sri Lanka.svg|border|20px|SRI]]" return y end -- Q854 = Sri Lanka
if x == 'Q858' then y = "[[File:Flag of Syria.svg|border|20px|SYR]]" return y end -- Q858 = Syrie
if x == 'Q863' then y = "[[File:Flag of Tajikistan.svg|border|20px|TJK]]" return y end -- Q863 = Tadjikistan
if x == 'Q865' then y = "[[File:Flag of the Republic of China.svg|border|20px|TPE]]" return y end -- Q865 = Taïwan
if x == 'Q869' then y = "[[File:Flag of Thailand.svg|border|20px|THA]]" return y end -- Q869 = Thaïlande
if x == 'Q874' then y = "[[File:Flag of Turkmenistan.svg|border|20px|THM]]" return y end -- Q874 = Turkménistan
if x == 'Q878' then y = "[[File:Flag of the United Arab Emirates.svg|border|20px|UAE]]" return y end -- Q875 = Émirats arabes unis
if x == 'Q881' then y = "[[File:Flag of Vietnam.svg|border|20px|VIE]]" return y end -- Q881 = Viêt Nam
if x == 'Q884' then y = "[[File:Flag of South Korea.svg|border|20px|KOR]]" return y end -- Q884 = Corée du Sud
if x == 'Q889' then y = "[[File:Flag of Afghanistan.svg|border|20px|AFG]]" return y end -- Q889 = Afghanistan
if x == 'Q902' then y = "[[File:Flag of Bangladesh.svg|border|20px|BAN]]" return y end -- Q902 = Bangladesh
if x == 'Q912' then y = "[[File:Flag of Mali.svg|border|20px|MLI]]" return y end -- Q912 = Mali
if x == 'Q916' then y = "[[File:Flag of Angola.svg|border|20px|ANG]]" return y end -- Q916 = Angola
if x == 'Q917' then y = "[[File:Flag of Bhutan.svg|border|20px|BHU]]" return y end -- Q917 = Bhoutan
if x == 'Q921' then y = "[[File:Flag of Brunei.svg|border|20px|BRU]]" return y end -- Q921 = Brunei
if x == 'Q924' then y = "[[File:Flag of Tanzania.svg|border|20px|TAN]]" return y end -- Q924 = Tanzanie
if x == 'Q928' then y = "[[File:Flag of the Philippines.svg|border|20px|PHI]]" return y end -- Q928 = Philippines
if x == 'Q929' then y = "[[File:Flag of the Central African Republic.svg|border|20px|CAF]]" return y end -- Q929 = République centrafricaine
if x == 'Q945' then y = "[[File:Flag of Togo.svg|border|20px|TOG]]" return y end -- Q945 = Togo
if x == 'Q948' then y = "[[File:Flag of Tunisia.svg|border|20px|TUN]]" return y end -- Q948 = Tunisie
if x == 'Q953' then y = "[[File:Flag of Zambia.svg|border|20px|ZAM]]" return y end -- Q953 = Zambie
if x == 'Q954' then y = "[[File:Flag of Zimbabwe.svg|border|20px|ZIM]]" return y end -- Q954 = Zimbabwe
if x == 'Q958' then y = "[[File:Flag of South Sudan.svg|border|20px|SSD]]" return y end -- Q958 = Soudan du Sud
if x == 'Q962' then y = "[[File:Flag of Benin.svg|border|20px|BEN]]" return y end -- Q962 = Bénin
if x == 'Q963' then y = "[[File:Flag of Botswana.svg|border|20px|BOT]]" return y end -- Q963 = Botswana
if x == 'Q965' then y = "[[File:Flag of Burkina Faso.svg|border|20px|BUR]]" return y end -- Q965 = Burkina faso
if x == 'Q967' then y = "[[File:Flag of Burundi.svg|border|20px|BDI]]" return y end -- Q967 = Burundi
if x == 'Q970' then y = "[[File:Flag of the Comoros.svg|border|20px|COM]]" return y end -- Q970 = Comores
if x == 'Q971' then y = "[[File:Flag of the Republic of the Congo.svg|border|20px|CGO]]" return y end -- Q971 = République du Congo
if x == 'Q974' then y = "[[File:Flag of the Democratic Republic of the Congo.svg|border|20px|COD]]" return y end -- Q974 = République démocratique du Congo
if x == 'Q977' then y = "[[File:Flag of Djibouti.svg|border|20px|DJI]]" return y end -- Q977 = Djibouti
if x == 'Q983' then y = "[[File:Flag of Equatorial Guinea.svg|border|20px|GEQ]]" return y end -- Q983 = Guinée équatoriale
if x == 'Q986' then y = "[[File:Flag of Eritrea.svg|border|20px|ERI]]" return y end -- Q986 = Érythrée
if x == 'Q1000' then y = "[[File:Flag of Gabon.svg|border|20px|GAB]]" return y end -- Q1000 = Gabon
if x == 'Q1005' then y = "[[File:Flag of The Gambia.svg|border|20px|GAM]]" return y end -- Q1005 = Gambie
if x == 'Q1006' then y = "[[File:Flag of Guinea.svg|border|20px|GUI]]" return y end -- Q1006 = Guinée
if x == 'Q1007' then y = "[[File:Flag of Guinea-Bissau.svg|border|20px|GBS]]" return y end -- Q1007 = Guinée-Bissau
if x == 'Q1008' then y = "[[File:Flag of Côte d'Ivoire.svg|border|20px|CIV]]" return y end -- Q1008 = Côte d'Ivoire
if x == 'Q1009' then y = "[[File:Flag of Cameroon.svg|border|20px|CMR]]" return y end -- Q1009 = Cameroun
if x == 'Q1011' then y = "[[File:Flag of Cape Verde.svg|border|20px|CPV]]" return y end -- Q1011 = Cap-Vert
if x == 'Q1013' then y = "[[File:Flag of Lesotho.svg|border|20px|LES]]" return y end -- Q1013 = Lesotho
if x == 'Q1014' then y = "[[File:Flag of Liberia.svg|border|20px|LBR]]" return y end -- Q1014 = Liberia
if x == 'Q1016' then y = "[[File:Flag of Libya (1951).svg|border|20px|LBA]]" return y end -- Q1016 = Libye
if x == 'Q1019' then y = "[[File:Flag of Madagascar.svg|border|20px|MAD]]" return y end -- Q1019 = Madagascar
if x == 'Q1020' then y = "[[File:Flag of Malawi.svg|border|20px|MAW]]" return y end -- Q1020 = Malawi
if x == 'Q1025' then y = "[[File:Flag of Mauritania.svg|border|20px|MTN]]" return y end -- Q1025 = Mauritanie
if x == 'Q1027' then y = "[[File:Flag of Mauritius.svg|border|20px|MRI]]" return y end -- Q1027 = Maurice
if x == 'Q1028' then y = "[[File:Flag of Morocco.svg|border|20px|MAR]]" return y end -- Q1028 = Maroc
if x == 'Q1029' then y = "[[File:Flag of Mozambique.svg|border|20px|MOZ]]" return y end -- Q1029 = Mozambique
if x == 'Q1030' then y = "[[File:Flag of Namibia.svg|border|20px|NAM]]" return y end -- Q1030 = Namibie
if x == 'Q1032' then y = "[[File:Flag of Niger.svg|border|20px|NIG]]" return y end -- Q1032 = Niger
if x == 'Q1033' then y = "[[File:Flag of Nigeria.svg|border|20px|NGR]]" return y end -- Q1033 = Nigeria
if x == 'Q1036' then y = "[[File:Flag of Uganda.svg|border|20px|UGA]]" return y end -- Q1036 = Ouganda
if x == 'Q1037' then y = "[[File:Flag of Rwanda.svg|border|20px|RWA]]" return y end -- Q1037 = Rwanda
if x == 'Q1039' then y = "[[File:Flag of Sao Tome and Principe.svg|border|20px|STP]]" return y end -- Q1039 = Sao Tomé-et-Principe
if x == 'Q1041' then y = "[[File:Flag of Senegal.svg|border|20px|SEN]]" return y end -- Q1041 = Sénégal
if x == 'Q1042' then y = "[[File:Flag of Seychelles.svg|border|20px|SEY]]" return y end -- Q1042 = Seychelles
if x == 'Q1044' then y = "[[File:Flag of Sierra Leone.svg|border|20px|SLE]]" return y end -- Q1044 = Sierra Leone
if x == 'Q1045' then y = "[[File:Flag of Somalia.svg|border|20px|SOM]]" return y end -- Q1045 = Somalie
if x == 'Q1049' then y = "[[File:Flag of Sudan.svg|border|20px|SUD]]" return y end -- Q1049 = Soudan
if x == 'Q1050' then y = "[[File:Flag of Swaziland.svg|border|20px|SWZ]]" return y end -- Q1050 = Swaziland
if x == 'Q1246' then y = "[[File:Flag of Kosovo.svg|border|20px|KOS]]" return y end -- Q1246 = Kosovo
if x == 'Q15180' then y = "[[File:Flag of the Soviet Union.svg|border|20px|URS]]" return y end -- Q15180 = Union des républiques socialistes soviétiques
if x == 'Q16957' then y = "[[File:Flag of East Germany.svg|border|20px|GDR]]" return y end -- Q16957 = République démocratique allemande
if x == 'Q26988' then y = "[[File:Flag of the Cook Islands.svg|border|20px|COK]]" return y end -- Q26988 = Îles cook
if x == 'Q28513' then y = "[[File:Flag of Austria-Hungary (1869-1918).svg|border|20px]]" return y end -- Q28513 = Autriche-Hongrie
if x == 'Q33946' then y = "[[File:Flag of the Czech Republic.svg|border|20px|TCH]]" return y end -- Q33946 = Tchécoslovaquie
if x == 'Q34020' then y = "[[File:Flag of Niue.svg|border|20px]]" return y end -- Q34020 = Niue
if x == 'Q34266' then y = "[[File:Flag of Russia.svg|border|20px|RU1]]" return y end -- Q34266 = Empire russe
if x == 'Q36704' then y = "[[File:Flag of SFR Yugoslavia.svg|border|20px|YUG]]" return y end -- Q36704 = Yougoslavie
return y
end
return p