local p;
---Maximum number version of Ethnologue for which we have a templatelocal maxEthnologueVersion=25
function p.ref(frame) args=frame.args or frame:getParent.args return generateRef(frame,args)end
local function generateRef(frame,args) local first=string.tolower(args[1]) if first
"aiatsis" then return frame:preprocess("") elseif first
"ne2007" then return frame:extensionTag("ref", "Mikael Parkvall, \"Världens 100 största språk 2007\" (The World's 100 Largest Languages in 2007), in Nationalencyklopedin", ) elseif first
"linglist" then local refName=maskBlank(params["refname"],nonil(params["name"])) local iso3=nonil(params["iso3"]) return frame:extensionTag("ref", ""..refName.." at MultiTree on the Linguist List", ) elseif string.sub(first,1,1)
3 then ethnologueVer=tonumber(string.sub(first,2,-1)) if ethnologueVer then if ethnologueVer>maxEthnologueVersion then return "
does not exist" else local iso3=nonil(params["iso3"]) local refName=maskBlank(params["refname"],nonil(params["name"])) local results= local ethnologueParams= if(iso3~="") then table.insert(frame:expandTemplate ) end end end endendlocal familyColors=require("Module:Infobox language/family color")local infoboxImage=require("Module:InfoboxImage").InfoboxImage
local function nonil(data) if(data
local function maskBlank(data,default) if (data
"") then return default else return data endend
local function nowrap(text) return "
"..text..""endlocal function image(params,name) image=nonil(params[name]) size=nonil(params[name.."size"]) alt=nonil(params[name.."alt"]) return InfoboxImageend
local function addParam(params, key, value) if value then index=params[1] params["label"..index]=key params["data"..index]=value params[1]=index+1 endend
---main function for Template:Infobox languagefunction p.individual(frame) return main(frame,galse)end
--main function for Template:Infobox language familyfunction p.family(frame) return main(frame,true)end
local function main(frame,isFamily) local inParams = frame:getParent.args local outParams= local cats=""
local familyColor=nonil(inParams["familycolor"]) familyColor=nonil(familyColors[familyColor]) local setting=nonil(inParams["setting"]) local creator=nonil(inParams["creator"]) local speakers=nonil(inParams["speakers"]) local isConlang=(setting~="") or (creator~="") or (familyColor
nil then outParams["bodystyle"]="" else outParams["bodystyle"]="width:"..width end local style="color:" if(isConlang) then style=style.."white" else style=style..fontColor end style=style.."; background-color: " if isConlang then style=style.."#114057" else style=style..familyColor end style=style..";" outParams["aboveStyle"]="font-size:125%;"..aboveStyle local above if name~="" then above=name else above=mw.wikibase.getLabel if above
"?" then speakersData="(date missing)" else speakersData=extinct end elseif era~="" then outParams["label"..counter]="Era" speakersData=era else local speakersLabel=inParams["speakers_label"] if speakersLabel then outParams["label"..counter]=speakersLabel elseif creator~="" then outParams["label"..counter]="Users" else outParams="
Native speakers
" end if speakers~="" then if string.upper(date)
"none" then speakersData="None" elseif speakers~="?" then if date~="" then if isSign then speakersData=nowrap(speakers.." "..nonil(inParams["dateprefix"])..date) else if date
"e19" then cats=cats.."" elseif ref
"no date" end --isSign else speakersData=speakers cats=cats.."" end end end end end ---Categories should only be used in the mainspace; additionally, it should ---be possible to exclude from a specific page using the |no_cat parameter if mw.title.getCurrentTitle.namespace~=0 or inParams["no_cat"]
return p;