-- Localizable part
-- Please, note, that labels to various sites and cataloges are taken from Wikidata (i.e. Wikidata label)  
local linksPrefix = ''
local project = 'Wikipedia'
local categoryTemplateEmpty = false
local categoryWithWikimediaCommons = false
local templateLink = 'View this template|link=Template:External links 2'  
local group1Label = 'Social networks'
local group2Label = 'Texts'
local group3Label = 'Audio, photo and video'
local group4Label = 'Profiles and catalogs'
local group5Label = 'Dictionaries and enciclopedias'
local group6Label = 'Authority control'  
-- The language codes that should be always displayed even if they have normal rank and claim with another language and prefferered rank exists
local preferredLanguage = 'Q1860'; -- English  
function categoryAuthorityControl( code )
return 'Wikipedia articles with ' .. code .. ' identifiers'
end
function categoryExternalLink( code )
return false
end  
local templateColorName = 'color';
-- some project have "named" colors, defined by templates
function colorByTitle( , colorTitle )
local templateName = 'Color/' .. colorTitle;
local templateTitle = mw.title.makeTitle( 'Template', templateName );
if ( templateTitle == nil or not templateTitle.exists ) then
return false;
end
return :expandTemplate{ title = templateName };
end  
-- feed free to correct labels and categories, or add/remove sources here
local dictionaryProperties = {
{ 'Grand Catalonian', 'P1296', function ( id ) return 'http://www.enciclopedia.cat/enciclopèdies/gran-enciclopèdia-catalana/EC-GEC-' .. id .. '.xml' end},
{ 'Grand Soviet', 'Q17378135', function ( link ) return link end},
{ 'Britannica', 'P1417', function ( id ) return 'http://global.britannica.com/'.. id end},
{ 'Brockhaus and Efron', 'Q602358', function ( title ) return ':s:ru:ЭСБЕ/' .. title end},
{ 'Kirill and Mefodiy', 'Q4091875', function ( link ) return link end },
{ 'Sort Literature', 'Q4239850', function ( link ) return link end},
{ 'Krugosvet', 'Q2627728', function ( link ) return link end},
{ 'Larousse', 'Q17329836', function ( link ) return link end},
{ 'Literature', 'Q4263804', function ( link ) return link end},
{ 'Lentapedia', 'Q17290934', function ( title ) return ':s:ru:Лентапедия/' .. title end},
{ 'Orthodox', 'Q2498180', function ( link ) return link end},
{ 'Historical of Switzerland', 'P902', function ( id ) return 'http://www.hls-dhs-dss.ch/textes/f/F' .. id .. '.php' end},
{ 'Historical of Switzerland (online)', 'P886', function ( id ) return 'http://www.e-lir.ch/e-LIR___Lexicon.' .. id .. '.450.0.html' end},
}  
-- Non-localizable part (not need to localize )
local moduleNavbox = require('Module:Navbox')  
local titleBasedLinks = { ['Q602358'] = true, ['Q17290934'] = true, }  
local p = {}  
function link( url )
return url
end  
function allocineFilmLink( id )
return 'http://www.allocine.fr/film/fichefilm_gen_cfilm=' .. id .. '.html'
end  
function allocinePersonneLink( id )
return 'http://www.allocine.fr/personne/fichepersonne_gen_cpersonne=' .. id .. '.html'
end  
function allocineSeriesLink( id )
return 'http://www.allocine.fr/series/ficheserie_gen_cserie=' .. id .. '.html'
end  
function animenewsnetworkLink( id )
if string.match( id, '^anime\/' ) then
return 'http://www.animenewsnetwork.com/encyclopedia/anime.php?id=' .. mw.ustring.sub( id, 7 )
end
if string.match( id, '^company\/' ) then
return 'http://www.animenewsnetwork.com/encyclopedia/company.php?id=' .. mw.ustring.sub( id, 9 )
end
if string.match( id, '^manga\/' ) then
return 'http://www.animenewsnetwork.com/encyclopedia/manga.php?id=' .. mw.ustring.sub( id, 7 )
end
if string.match( id, '^people\/' ) then
return 'http://www.animenewsnetwork.com/encyclopedia/people.php?id=' .. mw.ustring.sub( id, 8 )
end
if string.match( id, '^releases\/' ) then
return 'http://www.animenewsnetwork.com/encyclopedia/releases.php?id=' .. mw.ustring.sub( id, 10 )
end
return false
end  
function bavLink( id )
return 'http://viaf.org/processed/BAV%7C' .. id
end  
function bibsysLink( id )
return 'http://ask.bibsys.no/ask/action/result?cmd=&kilde=biblio&cql=bs.autid+%3D+' .. id .. '&feltselect=bs.autid'
end  
function bloggerLink( id )
return 'http://' .. id .. '.blogspot.com'
end  
function bncLink( id )
return 'http://cantic.bnc.cat/registres/CUCId/' .. id
end  
function bneLink( id )
return 'http://catalogo.bne.es/uhtbin/authoritybrowse.cgi?action=display&authority_id=' .. id
end  
function bnfLink( id )
return 'http://catalogue.bnf.fr/ark:/12148/cb' .. id
end  
function boxofficemojoLink( id )
return 'http://www.boxofficemojo.com/movies/?id=' .. id .. '.htm'
end  
function bpnLink( id ) return 'http://www.biografischportaal.nl/persoon/' .. id end
function calisLink( id ) return 'http://opac.calis.edu.cn/aopac/ajsp/detail.jsp?actionfrom=1&actl=CAL++' .. id end
function cbdbLink( id ) return 'http://db1.ihp.sinica.edu.tw/cbdbc/cbdbkmeng?~~AAA' .. id end
function ciniiLink( id ) return 'http://ci.nii.ac.jp/author/' .. id end
function conorLink( id ) return 'http://www.cobiss.si/scripts/cobiss?command=DISPLAY&base=CONOR&rid=' .. id end
function chitalnyaRuLink( id ) return 'http://www.chitalnya.ru/users/' .. id .. '/' end
function commonsWikimediaLink( id ) return ':commons:Category:' .. id end  
function dmozLink( id )
return 'http://www.dmoz.org/' .. id
end  
function duduLink( id )
return 'http://dudu.com/' .. id
end  
function egaxaLink( id )
return 'http://viaf.org/processed/EGAXA%7Cvtls' .. id
end  
function facebookLink( id )
return 'https://www.facebook.com/' .. id
end  
function fanLibRuLink( id )
local firstChar = mw.ustring.sub( id, 1, 1 )
return 'http://fan.lib.ru/' .. firstChar .. '/' .. id .. '/'
end  
function flickrLink( id )
return 'https://www.flickr.com/' .. id
end  
function findagraveLink( id )
return 'http://www.findagrave.com/cgi-bin/fg.cgi?page=gr&GRid=' .. id
end  
function genealogyAsmLink( id )
return 'http://www.genealogy.ams.org/id.php?id=' .. id
end  
function gndLink( id )
return 'http://d-nb.info/gnd/' .. id
end  
function ibdbPersonLink( id )
return 'http://www.ibdb.com/person.php?id=' .. id
end
function ibdbProductionLink( id )
return 'http://www.ibdb.com/production.php?id=' .. id
end
function ibdbShowLink( id )
return 'http://www.ibdb.com/show.php?id=' .. id
end
function ibdbVenueLink( id )
return 'http://www.ibdb.com/venue.php?id=' .. id
end  
function isfdbAuthorLink( id )
return 'http://www.isfdb.org/cgi-bin/ea.cgi?' .. id
end
function isfdbPublicationLink( id )
return 'http://www.isfdb.org/cgi-bin/pl.cgi?' .. id
end
function isfdbSeriesLink( id )
return 'http://www.isfdb.org/cgi-bin/pe.cgi?' .. id
end
function isfdbPublisherLink( id )
return 'http://www.isfdb.org/cgi-bin/publisher.cgi?' .. id
end  
function imslpLink( id )
return 'http://imslp.org/wiki/' .. id
end  
function imdbLink( id )
if string.match( id, '^ch' ) then
return 'http://www.imdb.com/character/' .. id
end
if string.match( id, '^co' ) then
return 'http://www.imdb.com/company/' .. id
end
if string.match( id, '^nm' ) then
return 'http://www.imdb.com/name/' .. id
end
if string.match( id, '^tt' ) then
return 'http://www.imdb.com/title/' .. id
end  
return false
end  
function isniLink( id )
id = id:gsub( '[ %-]', '' ):upper
return 'http://isni-url.oclc.nl/isni/' .. id
end  
function lccnLink( id )
return 'http://id.loc.gov/authorities/names/' .. id
end  
function lastfmLink( id )
return 'http://www.lastfm.ru/music/' .. id
end  
function liveinternetLink( id )
return 'http://www.liveinternet.ru/users/' .. id
end  
function livejournalLink( id )
return 'http://' .. id .. '.livejournal.com/'
end  
function iccuLink( id )
id = id:gsub( '\\\\', '%5C' ):upper
return 'http://opac.sbn.it/opacsbn/opac/iccu/scheda_authority.jsp?bid=' .. id
end  
function instagramLink( id )
return 'http://instagram.com/' .. id
end  
function lnbLink( id )
return 'http://viaf.org/processed/LNB%7CLNC10-' .. id
end  
function merimeeLink( id )
return false
end  
function mixcloudLink( id )