From Wikipedia, the free encyclopedia

This script is used to add images from Wikimedia Commons and/or links to Commons categories to certain lists of monuments. A full list of monument registers supported by the script can be found below.

How to use it

Anyone can use this script by adding

mw.loader.load('/?title=User:Dudemanfellabra/AddCommonsCatLinks.js&action=raw&ctype=text/javascript');

or on other language versions by adding

mw.loader.load('//en.wikipedia.org/?title=User:Dudemanfellabra/AddCommonsCatLinks.js&action=raw&ctype=text/javascript');

to the bottom of their personal JavaScript page. The script generates a button at the top of supported monument lists which reads "Check Commons for images and categories" (or the corresponding phrase in other supported languages). When clicked, the script extracts the unique IDs of the sites in the list and checks Commons for categories and images that have been identified with that same ID. If a match is found, the script prompts the user to choose to add the matched images and/or categories or elect not to add anything. Upon reaching the bottom of the list, the script automatically edits the list to include the chosen images/categories if the user chose to add any.

How it works

Every time the user visits a new page, the script queries the wikitext of that page and determines if a supported row template (see below) is transcluded therein. If one of these row templates is found, the button is placed at the top of the page; if not, the script exits itself. When the user clicks the button, the wikitext is parsed to extract all the rows and then cycles through them, querying Commons for matches to the unique ID specified in each row template one by one.

Row templates

For each of the supported registers listed below, there is a row template used to create the tables found in the list-articles on which this button is added. For example, lists of sites on the US National Register of Historic Places use the {{ NRHP row}} template to create each row in the tables. In the coding of this template, a parameter for a unique alphanumeric ID that identifies the site on that row is included (for the US NRHP, it is |refnum=########). This ID is used to add the site to the monuments database on Commons, allowing this script to recognize it. A good place to look for these row templates is Category:Monument list templates, although not all of the members of this category are supported by the script, and some supported templates may not be in this category.

Besides the unique identifier, it is also necessary that the row template adds the CSS class='vcard' to the row so that the script can recognize it. If this class is not present, the script will throw an error and exit itself.

Commons templates

The row templates identify the sites on the English Wikipedia, but other templates are needed to identify the images and categories on Commons. These templates can be found in commons:Category:Monument templates, though, again, not all of these templates are supported and some that are supported may not be in this category. These templates can be added to categories and files on Commons to mark them as being related to sites on their respective monument register. This is done by adding them to a category with the sortkey equal to the unique ID for that site. This script then queries the members of that category to find matches here. For example, any file or category on which commons:Template:NRHP is transcluded (along with a unique ID) is added to commons:Category:National Register of Historic Places with known IDs, in which this script then looks for matches. If the ID of a file/category on Commons matches the ID of a row template on a page here, the script suggests that file/category for inclusion here. It's that simple!

Other suggested matches

In addition to strict matches, i.e. when the ID of a file/category matches the ID of a row template, the script also makes suggestions in situations where files may not actually be tagged with a Commons template. If, for instance, a row in a list has a commons category specified when the script encounters it but does not include an image, the script will suggest that the user add an image that is in the pre-existing category. This is also the case if a row template has neither an image nor a Commons category when the script encounters it and the script finds a matching category but no matching images. In this case, the script suggests the images in the newly matched category for addition to the template. Of course, these are just suggestions and may not be actual matches since they have not been tagged on Commons definitively stating that they are images of this site, but the suggestions are often times accurate. If the suggested images (or even the strict matches) are not of the site in question or are not in the user's opinion of sufficient quality, there is always the option to forego adding an image or category to a row.

Bot output

Though this script can be run on any supported list, User:ErfgoedBot is instrumental in keeping up the Commons monuments database mentioned above and has some very helpful output that can be used to pinpoint where images and categories that have been identified on Commons need to be added here. An example output is Wikipedia:WikiProject National Register of Historic Places/Missing commons category links, which lists articles on which this script can be used to add links to Commons categories related to sites on the US NRHP. When there is a bot output available for a given register, it is linked in the supported registers table below.

Supported registers

The following table shows an extensive list of the monument registers on the English Wikipedia supported by this template, along with the relevant templates and categories this script uses. See below for monument registers supported on other language Wikipedias.

Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Antarctic Protected Areas Antarctica {{ Antarctic Protected Area row}} |type=, |number= commons:Template:Antarctic Protected Area commons:Category:Antarctic Protected Areas with known IDs
Monuments of Aruba Aruba {{ Table row Aruba monuments}} |objcode= commons:Template:Cultural Heritage Aruba commons:Category:Cultural heritage monuments in Aruba with known IDs
Beschermd erfgoed BelgiumFlemish Region {{ Table row BE}} |id= commons:Template:Onroerend erfgoed commons:Category:Onroerend erfgoed with known IDs
Beschermd erfgoed BelgiumWallonia {{ Table row Wallonia}} |niscode=, |objcode= commons:Template:Monument Wallonie commons:Category:Cultural heritage monuments in Wallonia with known IDs
Canadian Register of Historic Places Canada {{ HPC row}} |idf=, |idp=, |idm= commons:Template:Historic Places in Canada commons:Category:Heritage properties in Canada with known IDs
Major Historical and Cultural Site Protected at the National Level China {{ NHS China row}} |designation= commons:Template:Cultural Heritage China commons:Category:Cultural heritage monuments in China with known IDs
Ghana’s material cultural heritage Ghana {{ Ghana Monument row}} |id= commons:Template:Cultural Heritage Ghana commons:Category:Cultural heritage monuments in Ghana with known IDs
Declared monuments of Hong Kong Hong Kong {{ HK Declared Monument row}} |id= commons:Template:Declared monuments Hong Kong commons:Category:Declared monuments of Hong Kong with known IDs
Historic buildings in Hong Kong Hong Kong {{ HK Historic Building row}} |id= commons:Template:Historic buildings Hong Kong commons:Category:Historic buildings of Hong Kong with known IDs
Indian Monuments of National Importance India {{ ASI Monument row}} |number= commons:Template:Historic buildings Hong Kong commons:Category:ASI monuments with known ID's
Public art in Israel Israel {{ Public art in Israel - row}} |id= commons:Template:Public Art Israel commons:Category:Public art in Israel with known IDs
Monuments of Japan Japan {{ NHS Japan row}} |id= commons:Template:NHS Japan commons:Category:National historic sites of Japan with known IDs
Sites and monuments in Kenya Kenya {{ Kenya Monument row}} |id= commons:Template:Kenya Monument commons:Category:Kenya Monuments with known IDs
Monuments in Nepal Nepal {{ Nepal Monument row}} |number= commons:Template:Cultural Heritage Nepal commons:Category:Cultural heritage monuments in Nepal with known IDs
Cultural heritage sites in Pakistan Pakistan {{ PKmonument row}} |number= commons:Template:Cultural Heritage Pakistan commons:Category:Cultural heritage monuments in Pakistan with known IDs
Cultural Properties of the Philippines Philippines {{ Philippine cultural property row}} |cp-wmph-id= commons:Template:WMPH-ID commons:Category:Cultural heritage monuments in the Philippines with known IDs
National heritage sites of South Africa South Africa {{ SAHRA heritage site row}} |SiteReference= commons:Template:South African Heritage Site commons:Category:South Africa Heritage Resources with known IDs
Swiss Inventory of Cultural Property of National and Regional Significance Switzerland {{ SIoCPoNaRS row}} |KGS_nr= commons:Template:Cultural property of national significance in Switzerland commons:Category:Cultural properties of national significance in Switzerland with known IDs
National Cultural Sites in Uganda Uganda {{ National Cultural Site of Uganda row}} |number= commons:Template:National Cultural Site Uganda commons:Category:National Cultural Sites in Uganda with known IDs
Listed buildings in England United KingdomEngland {{ EH listed building row}} |uid= commons:Template:Listed building England commons:Category:Listed buildings in England with known IDs
Listed buildings in Wales United KingdomWales {{ Cadw listed building row}} |hb= commons:Template:Listed building Wales commons:Category:Listed buildings in Wales with known IDs
Listed buildings in Cardiff United KingdomWalesCardiff {{ Cardiff listed building row}} |hb= commons:Template:Listed building Wales commons:Category:Listed buildings in Wales with known IDs
Listed buildings in Scotland United KingdomScotland {{ HS listed building row}} |hb= commons:Template:Listed building Scotland commons:Category:Listed buildings in Scotland with known IDs
Listed buildings in Northern Ireland United KingdomNorthern Ireland {{ NIEA listed building row}} |hb= commons:Template:Listed building Northern Ireland commons:Category:Listed buildings in Northern Ireland with known IDs
United States National Register of Historic Places listings United States {{ NRHP row}} |refnum= commons:Template:NRHP commons:Category:National Register of Historic Places with known IDs
California Historical Landmarks United StatesCalifornia {{ CHL row}} |refnum= commons:Template:US-CHL commons:Category:California Historical Landmarks with known IDs

Other language Wikipedias

This script also supports lists on other language Wikipedias and is constantly expanding that support. While it may be possible to edit a list on a non-English Wikipedia, the GUI may or may not be displayed in that language. If the GUI has not yet been translated, the script will default to English, as will the edit summary (though the parameters added to the wikitext will be in the native language). If you can help translate the GUI into another language, please leave me a message at my talk page with the section title "I can help translate the CommonsCat script into LANGUAGE!"

A full list of supported registers on non-English Wikipedias is included below, sorted by the ISO 639 language code for that language (e.g. German's code is "de"). Click [show] next to the relevant language to display the list.

Arabic / العربية (ar)
Azerbaijani / azərbaycan dili (az)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Abidələrin siyahısı Azerbaijan {{ AZE Monument row}} |ID= commons:Template:Cultural Heritage Azerbaijan commons:Category:Cultural heritage monuments in Azerbaijan with known IDs
Belarusian / Беларуская (be/be-x-old)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Cultural Properties of Belarus Belarus {{ Вікі любіць славутасьці/Элемэнт сьпісу}} |шыфр= commons:Template:Belarus heritage commons:Category:Cultural heritage monuments in Belarus with known IDs
Czech / česky (cs)
GUI has been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Cultural monument (Czech Republic) Czech Republic {{ Památky v Česku}} |Id_objektu= commons:Template:Cultural Heritage Czech Republic commons:Category:Cultural monuments in the Czech Republic with known IDs
Danish / dansk (da)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
National Register of Sites and Monuments Denmark {{ Tabelrække FF}} |systemnummer= commons:Template:Fortidsminde commons:Category:Archaeological monuments in Denmark with known IDs
Listed buildings in Denmark Denmark {{ Tabelrække FBB}} |kommunenr=, |ejendomsnr=, |bygningsnr= commons:Template:Fredet bygning commons:Category:Listed buildings in Denmark with known IDs
German / Deutsch (de)
GUI has been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Denkmalgeschütztes Objekt Austria {{ Denkmalliste Österreich Tabellenzeile}} |ObjektID= commons:Template:Denkmalgeschütztes Objekt Österreich commons:Category:Cultural heritage monuments in Austria with known IDs
Naturdenkmal in Austria Austria {{ Naturdenkmal Österreich Tabellenzeile}} |ID= commons:Template:Naturdenkmal Österreich commons:Category:Natural monuments in Austria with known ID
Public art in Austria Austria {{ WLPA-AT-Zeile}} |ID= commons:Template:Public Art Austria commons:Category:Public Art in Austria with known IDs
Baudenkmäler in Bayern GermanyBavaria {{ Denkmalliste Bayern Tabellenzeile}} |Nummer= commons:Template:Baudenkmal Bayern commons:Category:Cultural heritage monuments in Bavaria with known IDs
Bau- und Bodendenkmale in Brandenburg GermanyBrandenburg {{ Denkmalliste Brandenburg Tabellenzeile}} |Id= commons:Template:Baudenkmal Brandenburg commons:Category:Cultural heritage monuments in Brandenburg with known ID
Kulturdenkmäler in Hessen GermanyHesse {{ Denkmalliste Hessen Tabellenzeile}} |Nummer= commons:Template:Kulturdenkmal Hessen commons:Category:Cultural heritage monuments in Hesse with known ID
Baudenkmäler in Nordrhein-Westfalen GermanyNorth Rhine-Westphalia {{ Denkmalliste1 Tabellenzeile}} |Nummer= commons:Template:Kulturdenkmal commons:Category:Cultural heritage monuments in NRW with known ID
Baudenkmäler in Bergheim-Mitte GermanyNorth Rhine-WestphaliaBergheim {{ Denkmalliste Bergheim Tabellenzeile}} |Nummer= commons:Template:Kulturdenkmal Bergheim commons:Category:Cultural heritage monuments in Bergheim with known ID
Baudenkmäler in Köln GermanyNorth Rhine-WestphaliaCologne {{ Denkmalliste Köln Tabellenzeile}} |Nummer_Denkmalliste= commons:Template:Kulturdenkmal Köln commons:Category:Cultural heritage monuments in Cologne with known ID
Kulturdenkmale in Sachsen GermanySaxony {{ Denkmalliste Sachsen Tabellenzeile}} |ID= commons:Template:Kulturdenkmal Sachsen commons:Category:Cultural heritage monuments in Saxony with known ID
Baudenkmäler in Südtirol ItalySouth Tyrol {{ Denkmalliste Südtirol Tabellenzeile}} |ObjektID= commons:Template:Denkmalgeschütztes Objekt Südtirol commons:Category:Cultural heritage monuments in South Tyrol with known IDs
National Inventory of Cultural Property of the Maltese Islands Malta {{ Denkmalliste Malta Tabellenzeile}} |Inventarnummer= commons:Template:National Inventory of Cultural Property of the Maltese Islands commons:Category:Cultural heritage monuments in Malta with known IDs
Cultural Heritage Monuments of Slovakia Slovakia {{ Denkmalliste Slowakei Tabellenzeile}} |ObjektID= commons:Template:Cultural Heritage Slovakia commons:Category:Cultural heritage monuments in Slovakia with known IDs
Swiss Inventory of Cultural Property of National and Regional Significance Switzerland {{ Denkmalliste Schweiz Tabellenzeile}}, {{ Denkmalliste2 Schweiz Tabellenzeile}}, {{ Denkmalliste2 Schweiz-ZH Tabellenzeile}}, {{ Kulturgüter Schweiz Tabellenzeile}} |KGS-Nr=, |ID= commons:Template:Cultural property of national significance in Switzerland commons:Category:Cultural properties of national significance in Switzerland with known IDs
Spanish / Español (es)
GUI has been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
National Historic Monuments of Argentina Argentina {{ MonumentoArgentina}} |id= commons:Template:Monumento Argentino commons:Category:Monuments in Argentina with known IDs
Monumentos nacionales de Bolivia Bolivia {{ MonumentoBolivia}} |id= commons:Template:Monumento Bolivia commons:Category:Cultural heritage monuments in Bolivia with known IDs
National Monuments of Chile Chile {{ MonumentoChile}} |id= commons:Template:Monumento Nacional de Chile commons:Category:National monuments in Chile with known IDs
National Monuments of Colombia Colombia {{ MonumentoColombia}} |id= commons:Template:Monumento Nacional de Colombia commons:Category:National monuments in Colombia with known IDs
Monuments of El Salvador El Salvador {{ MonumentoElSalvador}} |id= commons:Template:Cultural Heritage El Salvador commons:Category:Cultural heritage monuments in El Salvador with known IDs
Monuments of Mexico Mexico {{ MonumentoMéxico}} |id= commons:Template:Monumento de México commons:Category:Cultural heritage monuments in Mexico with known IDs
Monuments of Panama Panama {{ Fila PCN}} |registro= commons:Template:PCN commons:Category:Cultural heritage monuments in Panama with known IDs
Bien de Interés Cultural Spain {{ Fila BIC}} |bic= commons:Template:BIC commons:Category:Cultural heritage monuments in Spain with known IDs
National Monuments of Uruguay Uruguay {{ MonumentoUruguay}} |id= commons:Template:Monumento Uruguay commons:Category:Cultural heritage monuments in Uruguay with known IDs
National Monuments of Venezuela Venezuela {{ MonumentoVenezuela}} |id= commons:Template:Monumento Venezuela commons:Category:Cultural heritage monuments in Venezuela with known IDs
Estonian / eesti (et)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Eesti kultuurimälestised Estonia {{ KRR rida}} |number= commons:Template:Kultuurimälestis commons:Category:Cultural heritage monuments in Estonia (with known IDs)
Finnish / suomi (fi)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Public art in Finland Finland {{ Wlpa-teokset-rivi}} |id= commons:Template:Public Art Finland commons:Category:Public art in Finland with known IDs
Galician / Galego (gl)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Bien de Interés Cultural Spain {{ BIC}} |id= commons:Template:BIC commons:Category:Cultural heritage monuments in Spain with known IDs
Hebrew / עברית (he)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Monuments in Israel Israel {{ אתר מורשת בישראל בשורה}} |מספר אתר= commons:Template:Heritage site in Israel commons:Category:Heritage sites in Israel with known IDs
Hungarian / Magyar (hu)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Monuments in Hungary Hungary {{ Műemlék}} |azonosító= commons:Template:Monument Hungary commons:Category:Cultural heritage monuments in Hungary with known IDs
Armenian / Հայերեն (hy)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Monuments in Armenia Armenia {{ Հուշարձան ցանկ}} |համարանիշ= commons:Template:Cultural Heritage Armenia commons:Category:Cultural heritage monuments in Armenia with known IDs
Norwegian / Norsk (no)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Kulturminner in Norway Norway {{ Kulturminner row}} |id= commons:Template:Monument Norge commons:Category:Cultural heritage monuments in Norway with known IDs
Polish / polski (pl)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Objects of cultural heritage in Poland Poland {{ Zabytki/wpis}} |id= commons:Template:Zabytek nieruchomy commons:Category:Cultural heritage monuments in Poland with known IDs
Portuguese / Português (pt)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
National monuments of Portugal Portugal {{ IGESPAR/linha}} |id= commons:Template:IGESPAR commons:Category:IGESPAR with known IDs
Romanian / română (ro)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Monumente istorice Romania {{ ElementLMI}} |Cod= commons:Template:Monument istoric commons:Category:Cultural heritage monuments in Romania with known IDs
Russian / русский язык (ru)
Slovak / slovenčina (sk)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Cultural Heritage Monuments of Slovakia Slovakia {{ Monuments tableline-SK}} |IDobjektu= commons:Template:Cultural Heritage Slovakia commons:Category:Cultural heritage monuments in Slovakia with known IDs
Serbian / српски језик (sr)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Cultural Heritage of Serbia Serbia {{ Споменици ред}} |ИД= commons:Template:Cultural Heritage Serbia commons:Category:Cultural heritage monuments in Serbia with known IDs
Thai / ไทย (th)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Archaeological sites in Thailand Thailand {{ แถวโบราณสถาน}} |ทะเบียน= commons:Template:Cultural Heritage Thailand commons:Category:Cultural heritage monuments in Thailand with known IDs
Ukrainian / українська (uk)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
State Register of Immovable Monuments of Ukraine Ukraine {{ ВЛП-рядок}} |ID= commons:Template:Monument Ukraine commons:Category:Cultural heritage monuments in Ukraine with known IDs

Adding support for new registers/languages

In order to add support for new registers, the entire framework–row template, Commons template, and ID category–must be set up for the register. In addition to making this script more useful, converting existing lists of sites on heritage registers around the world into this format will improve the database on Commons as well and will be very useful for Wiki Loves Monuments, an annual international photo drive in which thousands of images of monuments are added to Commons. Support for any new registers which have been converted to this format can easily be added to the script by contacting User:Dudemanfellabra.

Support for registers on other language Wikipedias does not require anything more than registers on the English Wikipedia; however, if you want the GUI/edit summary to be displayed in the local language, it must first be translated from English. There are several strings that are displayed by the GUI, all of which must be translated before the language can be supported. The strings are shown below with their English versions and notes on when they are used when necessary as guidance for translation. If you are inclined to do so, translate the strings below and copy them to my talk page. I will add support for them as soon as possible.

Click [show] to see a list of strings to be translated in the GUI
 // The strings "ROWTEMPLATE", "NAME", "CATNAME", etc. should not be translated but can be moved around for better grammar.
 // These strings will be replaced by the relevant items during output.

 // text to be displayed in the button you click to start the script
        "ButtonText":"Check Commons for images and categories",
        "ImageOnlyText":"Check Commons for images only",
 // Error at the beginning of the script to catch templates that don't include the correct CSS class
        "RowMismatch":"Row mismatch! This is probably due to an incorrectly formatted row template. All row templates must include class='vcard' in order for this script to identify them. If {{ROWTEMPLATE}} does include class='vcard', please let me know at en:User_talk:Dudemanfellabra, and I will try to resolve the problem. The script will now exit itself. Sorry!",
// Similar error but for templates verified to have class='vcard'
        "MalformedRow":"Row mismatch! This is probably due to an incorrectly formatted row template in the wikicode, e.g. a missing }} or a misplaced HTML comment. If you cannot find the error on this page or believe it is due to something else, please let me know at :en:User_talk:Dudemanfellabra, and I will try to resolve the problem. The script will now exit itself. Sorry!",
 // self-explanatory
        "CheckingMatches":"Checking for matches...",
        "EditSummary":"[[:en:User:Dudemanfellabra/AddCommonsCatLinks|Semi-automated]] addition of image(s) and/or commonscat link(s) to monument list",
        "NoneFound":"No matches found or selected. Script exited.",
        "Found":"Matches found!",
        "Invalid":"The existing image and/or category cannot be found on Commons. Selecting a match here will replace the existing one(s). If you do not want to replace anything, choose Do not add any category/image.",
        "FollowingImages":"NAME matches the following images:",
 // asking to select either a matched image or a category; shouldn't include the words for "image" or "category"
        "SelectOne":"Select one to add:",
        "DontAddImage":"Do not add any image",
        "OtherSuggested":"Other suggested images for NAME from matched or existing categories:",
        "Suggested":"Suggested images for NAME from matched or existing categories:",
 // included with each suggested image showing which category it is a member of
        "From":"from CATNAME",
        "FollowingCats":"NAME matches the following categories:",
        "DontAddCat":"Do not add any category",
 // shown on the buttons
        "SelectButton":"Continue",
        "SaveButton":"Save progress and exit",
        "Done":"Done!<br>Editing page...",
        "SuccessfulEdit":"Done! Refresh the page to see the result!",
        "FailedEdit":"The edit query returned an error.",
        "LeavePage":"Are you sure you want to leave the page? All categories/files that you have added will not be saved!"

Troubleshooting

The following are known issues with the script that have not yet been addressed or are not technically feasible due to limitations of Wikimedia software:

  • If a single Commons template is transcluded multiple times on the same category/image because, e.g., multiple parts of the site in question are designated independently, the script can only detect the last one transcluded on the page. This is due to the limitation that a page in a category cannot have more than one sortkey (explained above), so each successive template simply overwrites the existing sortkey, making it invisible to this script. Note: This only applies to sites where a single template is transcluded multiple times; if a site is designated on two different registers marked by two different templates which include the category/image in two different categories, the script should detect each designation individually.
  • Sometimes the script will suggest an image/category when there is already one there, falsely claiming that the existing image/category does not in fact exist. For images, this is usually because the image itself is not stored on Commons but on the local language's Wikipedia. Choosing to add a matched/suggested image in this case will replace the existing image with the one on Commons. For categories, this means that the commonscat previously specified in the template cannot be found on Commons (likely a typo in the row template?). Choosing a matched/suggested category will replace the existing one. This also can happen if there is a linebreak in front of the file or category name, in which case adding the suggested image will break the template output.
  • The code tries hard to preserve the original formatting of the wikicode for the row template. If the row template is found to have each parameter on its own newline, the script will add a new line for the image/commonscat parameter; if the wikicode does not include newlines but rather just one big block of code, the script will add the parameter inline without forcing a linebreak. That said, the script is not so good at preserving spacing and other aesthetic formatting. Many times editors like to include spaces between parameter names and the equals sign (=) or pipes (|) for other parameters so the wikicode is more readable. This script is not intelligent enough (yet) to known how many spaces are needed to preserve this formatting, but small improvements are always being made. For now, it may be in the user's best interest to manually review the wikicode after using the script to preserve any spacing and avoid angering other editors.

If any errors or undesired behaviors apart from those listed above are encountered while using this script, please direct questions to User:Dudemanfellabra, the script's creator.

From Wikipedia, the free encyclopedia

This script is used to add images from Wikimedia Commons and/or links to Commons categories to certain lists of monuments. A full list of monument registers supported by the script can be found below.

How to use it

Anyone can use this script by adding

mw.loader.load('/?title=User:Dudemanfellabra/AddCommonsCatLinks.js&action=raw&ctype=text/javascript');

or on other language versions by adding

mw.loader.load('//en.wikipedia.org/?title=User:Dudemanfellabra/AddCommonsCatLinks.js&action=raw&ctype=text/javascript');

to the bottom of their personal JavaScript page. The script generates a button at the top of supported monument lists which reads "Check Commons for images and categories" (or the corresponding phrase in other supported languages). When clicked, the script extracts the unique IDs of the sites in the list and checks Commons for categories and images that have been identified with that same ID. If a match is found, the script prompts the user to choose to add the matched images and/or categories or elect not to add anything. Upon reaching the bottom of the list, the script automatically edits the list to include the chosen images/categories if the user chose to add any.

How it works

Every time the user visits a new page, the script queries the wikitext of that page and determines if a supported row template (see below) is transcluded therein. If one of these row templates is found, the button is placed at the top of the page; if not, the script exits itself. When the user clicks the button, the wikitext is parsed to extract all the rows and then cycles through them, querying Commons for matches to the unique ID specified in each row template one by one.

Row templates

For each of the supported registers listed below, there is a row template used to create the tables found in the list-articles on which this button is added. For example, lists of sites on the US National Register of Historic Places use the {{ NRHP row}} template to create each row in the tables. In the coding of this template, a parameter for a unique alphanumeric ID that identifies the site on that row is included (for the US NRHP, it is |refnum=########). This ID is used to add the site to the monuments database on Commons, allowing this script to recognize it. A good place to look for these row templates is Category:Monument list templates, although not all of the members of this category are supported by the script, and some supported templates may not be in this category.

Besides the unique identifier, it is also necessary that the row template adds the CSS class='vcard' to the row so that the script can recognize it. If this class is not present, the script will throw an error and exit itself.

Commons templates

The row templates identify the sites on the English Wikipedia, but other templates are needed to identify the images and categories on Commons. These templates can be found in commons:Category:Monument templates, though, again, not all of these templates are supported and some that are supported may not be in this category. These templates can be added to categories and files on Commons to mark them as being related to sites on their respective monument register. This is done by adding them to a category with the sortkey equal to the unique ID for that site. This script then queries the members of that category to find matches here. For example, any file or category on which commons:Template:NRHP is transcluded (along with a unique ID) is added to commons:Category:National Register of Historic Places with known IDs, in which this script then looks for matches. If the ID of a file/category on Commons matches the ID of a row template on a page here, the script suggests that file/category for inclusion here. It's that simple!

Other suggested matches

In addition to strict matches, i.e. when the ID of a file/category matches the ID of a row template, the script also makes suggestions in situations where files may not actually be tagged with a Commons template. If, for instance, a row in a list has a commons category specified when the script encounters it but does not include an image, the script will suggest that the user add an image that is in the pre-existing category. This is also the case if a row template has neither an image nor a Commons category when the script encounters it and the script finds a matching category but no matching images. In this case, the script suggests the images in the newly matched category for addition to the template. Of course, these are just suggestions and may not be actual matches since they have not been tagged on Commons definitively stating that they are images of this site, but the suggestions are often times accurate. If the suggested images (or even the strict matches) are not of the site in question or are not in the user's opinion of sufficient quality, there is always the option to forego adding an image or category to a row.

Bot output

Though this script can be run on any supported list, User:ErfgoedBot is instrumental in keeping up the Commons monuments database mentioned above and has some very helpful output that can be used to pinpoint where images and categories that have been identified on Commons need to be added here. An example output is Wikipedia:WikiProject National Register of Historic Places/Missing commons category links, which lists articles on which this script can be used to add links to Commons categories related to sites on the US NRHP. When there is a bot output available for a given register, it is linked in the supported registers table below.

Supported registers

The following table shows an extensive list of the monument registers on the English Wikipedia supported by this template, along with the relevant templates and categories this script uses. See below for monument registers supported on other language Wikipedias.

Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Antarctic Protected Areas Antarctica {{ Antarctic Protected Area row}} |type=, |number= commons:Template:Antarctic Protected Area commons:Category:Antarctic Protected Areas with known IDs
Monuments of Aruba Aruba {{ Table row Aruba monuments}} |objcode= commons:Template:Cultural Heritage Aruba commons:Category:Cultural heritage monuments in Aruba with known IDs
Beschermd erfgoed BelgiumFlemish Region {{ Table row BE}} |id= commons:Template:Onroerend erfgoed commons:Category:Onroerend erfgoed with known IDs
Beschermd erfgoed BelgiumWallonia {{ Table row Wallonia}} |niscode=, |objcode= commons:Template:Monument Wallonie commons:Category:Cultural heritage monuments in Wallonia with known IDs
Canadian Register of Historic Places Canada {{ HPC row}} |idf=, |idp=, |idm= commons:Template:Historic Places in Canada commons:Category:Heritage properties in Canada with known IDs
Major Historical and Cultural Site Protected at the National Level China {{ NHS China row}} |designation= commons:Template:Cultural Heritage China commons:Category:Cultural heritage monuments in China with known IDs
Ghana’s material cultural heritage Ghana {{ Ghana Monument row}} |id= commons:Template:Cultural Heritage Ghana commons:Category:Cultural heritage monuments in Ghana with known IDs
Declared monuments of Hong Kong Hong Kong {{ HK Declared Monument row}} |id= commons:Template:Declared monuments Hong Kong commons:Category:Declared monuments of Hong Kong with known IDs
Historic buildings in Hong Kong Hong Kong {{ HK Historic Building row}} |id= commons:Template:Historic buildings Hong Kong commons:Category:Historic buildings of Hong Kong with known IDs
Indian Monuments of National Importance India {{ ASI Monument row}} |number= commons:Template:Historic buildings Hong Kong commons:Category:ASI monuments with known ID's
Public art in Israel Israel {{ Public art in Israel - row}} |id= commons:Template:Public Art Israel commons:Category:Public art in Israel with known IDs
Monuments of Japan Japan {{ NHS Japan row}} |id= commons:Template:NHS Japan commons:Category:National historic sites of Japan with known IDs
Sites and monuments in Kenya Kenya {{ Kenya Monument row}} |id= commons:Template:Kenya Monument commons:Category:Kenya Monuments with known IDs
Monuments in Nepal Nepal {{ Nepal Monument row}} |number= commons:Template:Cultural Heritage Nepal commons:Category:Cultural heritage monuments in Nepal with known IDs
Cultural heritage sites in Pakistan Pakistan {{ PKmonument row}} |number= commons:Template:Cultural Heritage Pakistan commons:Category:Cultural heritage monuments in Pakistan with known IDs
Cultural Properties of the Philippines Philippines {{ Philippine cultural property row}} |cp-wmph-id= commons:Template:WMPH-ID commons:Category:Cultural heritage monuments in the Philippines with known IDs
National heritage sites of South Africa South Africa {{ SAHRA heritage site row}} |SiteReference= commons:Template:South African Heritage Site commons:Category:South Africa Heritage Resources with known IDs
Swiss Inventory of Cultural Property of National and Regional Significance Switzerland {{ SIoCPoNaRS row}} |KGS_nr= commons:Template:Cultural property of national significance in Switzerland commons:Category:Cultural properties of national significance in Switzerland with known IDs
National Cultural Sites in Uganda Uganda {{ National Cultural Site of Uganda row}} |number= commons:Template:National Cultural Site Uganda commons:Category:National Cultural Sites in Uganda with known IDs
Listed buildings in England United KingdomEngland {{ EH listed building row}} |uid= commons:Template:Listed building England commons:Category:Listed buildings in England with known IDs
Listed buildings in Wales United KingdomWales {{ Cadw listed building row}} |hb= commons:Template:Listed building Wales commons:Category:Listed buildings in Wales with known IDs
Listed buildings in Cardiff United KingdomWalesCardiff {{ Cardiff listed building row}} |hb= commons:Template:Listed building Wales commons:Category:Listed buildings in Wales with known IDs
Listed buildings in Scotland United KingdomScotland {{ HS listed building row}} |hb= commons:Template:Listed building Scotland commons:Category:Listed buildings in Scotland with known IDs
Listed buildings in Northern Ireland United KingdomNorthern Ireland {{ NIEA listed building row}} |hb= commons:Template:Listed building Northern Ireland commons:Category:Listed buildings in Northern Ireland with known IDs
United States National Register of Historic Places listings United States {{ NRHP row}} |refnum= commons:Template:NRHP commons:Category:National Register of Historic Places with known IDs
California Historical Landmarks United StatesCalifornia {{ CHL row}} |refnum= commons:Template:US-CHL commons:Category:California Historical Landmarks with known IDs

Other language Wikipedias

This script also supports lists on other language Wikipedias and is constantly expanding that support. While it may be possible to edit a list on a non-English Wikipedia, the GUI may or may not be displayed in that language. If the GUI has not yet been translated, the script will default to English, as will the edit summary (though the parameters added to the wikitext will be in the native language). If you can help translate the GUI into another language, please leave me a message at my talk page with the section title "I can help translate the CommonsCat script into LANGUAGE!"

A full list of supported registers on non-English Wikipedias is included below, sorted by the ISO 639 language code for that language (e.g. German's code is "de"). Click [show] next to the relevant language to display the list.

Arabic / العربية (ar)
Azerbaijani / azərbaycan dili (az)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Abidələrin siyahısı Azerbaijan {{ AZE Monument row}} |ID= commons:Template:Cultural Heritage Azerbaijan commons:Category:Cultural heritage monuments in Azerbaijan with known IDs
Belarusian / Беларуская (be/be-x-old)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Cultural Properties of Belarus Belarus {{ Вікі любіць славутасьці/Элемэнт сьпісу}} |шыфр= commons:Template:Belarus heritage commons:Category:Cultural heritage monuments in Belarus with known IDs
Czech / česky (cs)
GUI has been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Cultural monument (Czech Republic) Czech Republic {{ Památky v Česku}} |Id_objektu= commons:Template:Cultural Heritage Czech Republic commons:Category:Cultural monuments in the Czech Republic with known IDs
Danish / dansk (da)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
National Register of Sites and Monuments Denmark {{ Tabelrække FF}} |systemnummer= commons:Template:Fortidsminde commons:Category:Archaeological monuments in Denmark with known IDs
Listed buildings in Denmark Denmark {{ Tabelrække FBB}} |kommunenr=, |ejendomsnr=, |bygningsnr= commons:Template:Fredet bygning commons:Category:Listed buildings in Denmark with known IDs
German / Deutsch (de)
GUI has been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Denkmalgeschütztes Objekt Austria {{ Denkmalliste Österreich Tabellenzeile}} |ObjektID= commons:Template:Denkmalgeschütztes Objekt Österreich commons:Category:Cultural heritage monuments in Austria with known IDs
Naturdenkmal in Austria Austria {{ Naturdenkmal Österreich Tabellenzeile}} |ID= commons:Template:Naturdenkmal Österreich commons:Category:Natural monuments in Austria with known ID
Public art in Austria Austria {{ WLPA-AT-Zeile}} |ID= commons:Template:Public Art Austria commons:Category:Public Art in Austria with known IDs
Baudenkmäler in Bayern GermanyBavaria {{ Denkmalliste Bayern Tabellenzeile}} |Nummer= commons:Template:Baudenkmal Bayern commons:Category:Cultural heritage monuments in Bavaria with known IDs
Bau- und Bodendenkmale in Brandenburg GermanyBrandenburg {{ Denkmalliste Brandenburg Tabellenzeile}} |Id= commons:Template:Baudenkmal Brandenburg commons:Category:Cultural heritage monuments in Brandenburg with known ID
Kulturdenkmäler in Hessen GermanyHesse {{ Denkmalliste Hessen Tabellenzeile}} |Nummer= commons:Template:Kulturdenkmal Hessen commons:Category:Cultural heritage monuments in Hesse with known ID
Baudenkmäler in Nordrhein-Westfalen GermanyNorth Rhine-Westphalia {{ Denkmalliste1 Tabellenzeile}} |Nummer= commons:Template:Kulturdenkmal commons:Category:Cultural heritage monuments in NRW with known ID
Baudenkmäler in Bergheim-Mitte GermanyNorth Rhine-WestphaliaBergheim {{ Denkmalliste Bergheim Tabellenzeile}} |Nummer= commons:Template:Kulturdenkmal Bergheim commons:Category:Cultural heritage monuments in Bergheim with known ID
Baudenkmäler in Köln GermanyNorth Rhine-WestphaliaCologne {{ Denkmalliste Köln Tabellenzeile}} |Nummer_Denkmalliste= commons:Template:Kulturdenkmal Köln commons:Category:Cultural heritage monuments in Cologne with known ID
Kulturdenkmale in Sachsen GermanySaxony {{ Denkmalliste Sachsen Tabellenzeile}} |ID= commons:Template:Kulturdenkmal Sachsen commons:Category:Cultural heritage monuments in Saxony with known ID
Baudenkmäler in Südtirol ItalySouth Tyrol {{ Denkmalliste Südtirol Tabellenzeile}} |ObjektID= commons:Template:Denkmalgeschütztes Objekt Südtirol commons:Category:Cultural heritage monuments in South Tyrol with known IDs
National Inventory of Cultural Property of the Maltese Islands Malta {{ Denkmalliste Malta Tabellenzeile}} |Inventarnummer= commons:Template:National Inventory of Cultural Property of the Maltese Islands commons:Category:Cultural heritage monuments in Malta with known IDs
Cultural Heritage Monuments of Slovakia Slovakia {{ Denkmalliste Slowakei Tabellenzeile}} |ObjektID= commons:Template:Cultural Heritage Slovakia commons:Category:Cultural heritage monuments in Slovakia with known IDs
Swiss Inventory of Cultural Property of National and Regional Significance Switzerland {{ Denkmalliste Schweiz Tabellenzeile}}, {{ Denkmalliste2 Schweiz Tabellenzeile}}, {{ Denkmalliste2 Schweiz-ZH Tabellenzeile}}, {{ Kulturgüter Schweiz Tabellenzeile}} |KGS-Nr=, |ID= commons:Template:Cultural property of national significance in Switzerland commons:Category:Cultural properties of national significance in Switzerland with known IDs
Spanish / Español (es)
GUI has been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
National Historic Monuments of Argentina Argentina {{ MonumentoArgentina}} |id= commons:Template:Monumento Argentino commons:Category:Monuments in Argentina with known IDs
Monumentos nacionales de Bolivia Bolivia {{ MonumentoBolivia}} |id= commons:Template:Monumento Bolivia commons:Category:Cultural heritage monuments in Bolivia with known IDs
National Monuments of Chile Chile {{ MonumentoChile}} |id= commons:Template:Monumento Nacional de Chile commons:Category:National monuments in Chile with known IDs
National Monuments of Colombia Colombia {{ MonumentoColombia}} |id= commons:Template:Monumento Nacional de Colombia commons:Category:National monuments in Colombia with known IDs
Monuments of El Salvador El Salvador {{ MonumentoElSalvador}} |id= commons:Template:Cultural Heritage El Salvador commons:Category:Cultural heritage monuments in El Salvador with known IDs
Monuments of Mexico Mexico {{ MonumentoMéxico}} |id= commons:Template:Monumento de México commons:Category:Cultural heritage monuments in Mexico with known IDs
Monuments of Panama Panama {{ Fila PCN}} |registro= commons:Template:PCN commons:Category:Cultural heritage monuments in Panama with known IDs
Bien de Interés Cultural Spain {{ Fila BIC}} |bic= commons:Template:BIC commons:Category:Cultural heritage monuments in Spain with known IDs
National Monuments of Uruguay Uruguay {{ MonumentoUruguay}} |id= commons:Template:Monumento Uruguay commons:Category:Cultural heritage monuments in Uruguay with known IDs
National Monuments of Venezuela Venezuela {{ MonumentoVenezuela}} |id= commons:Template:Monumento Venezuela commons:Category:Cultural heritage monuments in Venezuela with known IDs
Estonian / eesti (et)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Eesti kultuurimälestised Estonia {{ KRR rida}} |number= commons:Template:Kultuurimälestis commons:Category:Cultural heritage monuments in Estonia (with known IDs)
Finnish / suomi (fi)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Public art in Finland Finland {{ Wlpa-teokset-rivi}} |id= commons:Template:Public Art Finland commons:Category:Public art in Finland with known IDs
Galician / Galego (gl)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Bien de Interés Cultural Spain {{ BIC}} |id= commons:Template:BIC commons:Category:Cultural heritage monuments in Spain with known IDs
Hebrew / עברית (he)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Monuments in Israel Israel {{ אתר מורשת בישראל בשורה}} |מספר אתר= commons:Template:Heritage site in Israel commons:Category:Heritage sites in Israel with known IDs
Hungarian / Magyar (hu)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Monuments in Hungary Hungary {{ Műemlék}} |azonosító= commons:Template:Monument Hungary commons:Category:Cultural heritage monuments in Hungary with known IDs
Armenian / Հայերեն (hy)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Monuments in Armenia Armenia {{ Հուշարձան ցանկ}} |համարանիշ= commons:Template:Cultural Heritage Armenia commons:Category:Cultural heritage monuments in Armenia with known IDs
Norwegian / Norsk (no)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Kulturminner in Norway Norway {{ Kulturminner row}} |id= commons:Template:Monument Norge commons:Category:Cultural heritage monuments in Norway with known IDs
Polish / polski (pl)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Objects of cultural heritage in Poland Poland {{ Zabytki/wpis}} |id= commons:Template:Zabytek nieruchomy commons:Category:Cultural heritage monuments in Poland with known IDs
Portuguese / Português (pt)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
National monuments of Portugal Portugal {{ IGESPAR/linha}} |id= commons:Template:IGESPAR commons:Category:IGESPAR with known IDs
Romanian / română (ro)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Monumente istorice Romania {{ ElementLMI}} |Cod= commons:Template:Monument istoric commons:Category:Cultural heritage monuments in Romania with known IDs
Russian / русский язык (ru)
Slovak / slovenčina (sk)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Cultural Heritage Monuments of Slovakia Slovakia {{ Monuments tableline-SK}} |IDobjektu= commons:Template:Cultural Heritage Slovakia commons:Category:Cultural heritage monuments in Slovakia with known IDs
Serbian / српски језик (sr)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Cultural Heritage of Serbia Serbia {{ Споменици ред}} |ИД= commons:Template:Cultural Heritage Serbia commons:Category:Cultural heritage monuments in Serbia with known IDs
Thai / ไทย (th)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
Archaeological sites in Thailand Thailand {{ แถวโบราณสถาน}} |ทะเบียน= commons:Template:Cultural Heritage Thailand commons:Category:Cultural heritage monuments in Thailand with known IDs
Ukrainian / українська (uk)
GUI has not been translated.
Register name Country/Location Row template Unique ID parameter(s) Commons template Commons category Bot output
Cats Images
State Register of Immovable Monuments of Ukraine Ukraine {{ ВЛП-рядок}} |ID= commons:Template:Monument Ukraine commons:Category:Cultural heritage monuments in Ukraine with known IDs

Adding support for new registers/languages

In order to add support for new registers, the entire framework–row template, Commons template, and ID category–must be set up for the register. In addition to making this script more useful, converting existing lists of sites on heritage registers around the world into this format will improve the database on Commons as well and will be very useful for Wiki Loves Monuments, an annual international photo drive in which thousands of images of monuments are added to Commons. Support for any new registers which have been converted to this format can easily be added to the script by contacting User:Dudemanfellabra.

Support for registers on other language Wikipedias does not require anything more than registers on the English Wikipedia; however, if you want the GUI/edit summary to be displayed in the local language, it must first be translated from English. There are several strings that are displayed by the GUI, all of which must be translated before the language can be supported. The strings are shown below with their English versions and notes on when they are used when necessary as guidance for translation. If you are inclined to do so, translate the strings below and copy them to my talk page. I will add support for them as soon as possible.

Click [show] to see a list of strings to be translated in the GUI
 // The strings "ROWTEMPLATE", "NAME", "CATNAME", etc. should not be translated but can be moved around for better grammar.
 // These strings will be replaced by the relevant items during output.

 // text to be displayed in the button you click to start the script
        "ButtonText":"Check Commons for images and categories",
        "ImageOnlyText":"Check Commons for images only",
 // Error at the beginning of the script to catch templates that don't include the correct CSS class
        "RowMismatch":"Row mismatch! This is probably due to an incorrectly formatted row template. All row templates must include class='vcard' in order for this script to identify them. If {{ROWTEMPLATE}} does include class='vcard', please let me know at en:User_talk:Dudemanfellabra, and I will try to resolve the problem. The script will now exit itself. Sorry!",
// Similar error but for templates verified to have class='vcard'
        "MalformedRow":"Row mismatch! This is probably due to an incorrectly formatted row template in the wikicode, e.g. a missing }} or a misplaced HTML comment. If you cannot find the error on this page or believe it is due to something else, please let me know at :en:User_talk:Dudemanfellabra, and I will try to resolve the problem. The script will now exit itself. Sorry!",
 // self-explanatory
        "CheckingMatches":"Checking for matches...",
        "EditSummary":"[[:en:User:Dudemanfellabra/AddCommonsCatLinks|Semi-automated]] addition of image(s) and/or commonscat link(s) to monument list",
        "NoneFound":"No matches found or selected. Script exited.",
        "Found":"Matches found!",
        "Invalid":"The existing image and/or category cannot be found on Commons. Selecting a match here will replace the existing one(s). If you do not want to replace anything, choose Do not add any category/image.",
        "FollowingImages":"NAME matches the following images:",
 // asking to select either a matched image or a category; shouldn't include the words for "image" or "category"
        "SelectOne":"Select one to add:",
        "DontAddImage":"Do not add any image",
        "OtherSuggested":"Other suggested images for NAME from matched or existing categories:",
        "Suggested":"Suggested images for NAME from matched or existing categories:",
 // included with each suggested image showing which category it is a member of
        "From":"from CATNAME",
        "FollowingCats":"NAME matches the following categories:",
        "DontAddCat":"Do not add any category",
 // shown on the buttons
        "SelectButton":"Continue",
        "SaveButton":"Save progress and exit",
        "Done":"Done!<br>Editing page...",
        "SuccessfulEdit":"Done! Refresh the page to see the result!",
        "FailedEdit":"The edit query returned an error.",
        "LeavePage":"Are you sure you want to leave the page? All categories/files that you have added will not be saved!"

Troubleshooting

The following are known issues with the script that have not yet been addressed or are not technically feasible due to limitations of Wikimedia software:

  • If a single Commons template is transcluded multiple times on the same category/image because, e.g., multiple parts of the site in question are designated independently, the script can only detect the last one transcluded on the page. This is due to the limitation that a page in a category cannot have more than one sortkey (explained above), so each successive template simply overwrites the existing sortkey, making it invisible to this script. Note: This only applies to sites where a single template is transcluded multiple times; if a site is designated on two different registers marked by two different templates which include the category/image in two different categories, the script should detect each designation individually.
  • Sometimes the script will suggest an image/category when there is already one there, falsely claiming that the existing image/category does not in fact exist. For images, this is usually because the image itself is not stored on Commons but on the local language's Wikipedia. Choosing to add a matched/suggested image in this case will replace the existing image with the one on Commons. For categories, this means that the commonscat previously specified in the template cannot be found on Commons (likely a typo in the row template?). Choosing a matched/suggested category will replace the existing one. This also can happen if there is a linebreak in front of the file or category name, in which case adding the suggested image will break the template output.
  • The code tries hard to preserve the original formatting of the wikicode for the row template. If the row template is found to have each parameter on its own newline, the script will add a new line for the image/commonscat parameter; if the wikicode does not include newlines but rather just one big block of code, the script will add the parameter inline without forcing a linebreak. That said, the script is not so good at preserving spacing and other aesthetic formatting. Many times editors like to include spaces between parameter names and the equals sign (=) or pipes (|) for other parameters so the wikicode is more readable. This script is not intelligent enough (yet) to known how many spaces are needed to preserve this formatting, but small improvements are always being made. For now, it may be in the user's best interest to manually review the wikicode after using the script to preserve any spacing and avoid angering other editors.

If any errors or undesired behaviors apart from those listed above are encountered while using this script, please direct questions to User:Dudemanfellabra, the script's creator.


Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook