Module:Cycling race/lang

From Wikidata
Jump to navigation Jump to search
Lua
CodeDiscussionLinksLink count SubpagesDocumentationTestsResultsSandboxLive code All modules

Documentation for this module may be created at Module:Cycling race/lang/doc

Code

local translations = {}
function translations.list(item)
--[[
Using country items to get the name of a country is very slow. Expand and translate this list to your needs, for example to all Scandinavian items or 
South-Amercon items if this is your main topic. The information for rarely used countries is taken from Wikidata. Maybe adding 300+ country names is to much 
and it is to much work to insert them all by hand, but 30 or 40 should be OK.
]]	
local list = {}
list={ ["Q16"]="Canada", ["Q17"]="Japon", ["Q20"]="Norvège", ["Q29"]="Espagne", ["Q30"]="États-Unis", ["Q31"]="Belgique", ["Q32"]="Luxembourg", 
	["Q33"]="Finlande", ["Q34"]="Suède", ["Q35"]="Danemark", ["Q36"]="Pologne", ["Q37"]="Lituanie", ["Q38"]="Italie", ["Q39"]="Suisse", 
	["Q55"]="Pays-Bas", ["Q77"]="Uruguay", ["Q96"]="Mexique", ["Q142"]="France", ["Q145"]="Royaume-Uni", ["Q159"]="Russie", 
	["Q183"]="Allemagne", ['Q214']='Slovaquie', ["Q408"]="Australie", ["Q414"]="Argentine", ["Q664"]="Nouvelle-Zélande", ["Q717"]="Venezuela", 
	["Q739"]="Colombie", ["Q29999"]="Pays-Bas" } 
local value = list[item]
if value ~= nil then return value else return '' end
end

--[[
This is for the data in "official name" - qualifiers in team items. The first element in the list lang_priority has the highest priority. 
The code looks first in Wikidata team items if there is a translation in this language. If there is no such translation, the next language is taken. 
In case no matching "official name" - qualifier is available, the standard "official name" is printed, that is the one that is the value in that statement. 

If a wiki doesn´t have the lang module or this variable is not inserted into the lang module , the "official name" - qualifiers are ignored. 

It is used to print non latin team names in the cycling race tables and local team names, for example "Team Sky" instead of "Sky".
]]        

--translations.lang_priority = {'ja', 'mk', 'ru'} 

return translations