Help:Creating multilingual tags with interwiki links

From Wikimedia Commons, the free media repository
Jump to: navigation, search

Note: it is no longer needed to insert interwiki links on Commons. Instead feed them in Wikidata - you should look at the matching article (or the category) on Wikipedia to find the existing Wikidata entry. Then add data for the article subject in field "Category on Wikimedia Commons", and search or create a page with "Element type"="Category on Wikimedia" (for listing the categories on all editions of Wikipedia and Commons). Commons will then automatically list the interwikis in the gallery pages for the subject, and in its associated category page.


Deprecated

Many templates in Category:Multilingual tags are for names of geographical locations like {{London}}, people like {{Philip the Good}}, institutions like {{Hermitage Museum}}, artworks like {{Mona Lisa}}, etc. Great majority of those templates follow the same format:

  1. they use {{LangSwitch}} template to show the name in the language of the user
  2. they each name has a link to a wikipedia page on the subject in the language of the user

Such templates are used as fields of {{Artwork}}, {{Creator}}, {{Institution}}, {{Book}}, etc. templates and are building blocks of internationalization of Wikimadia Commons content. Creation of such templates is done based on wikipedia Interlanguage links. For example London has few hundred interlanguage links like:

[[el:Λονδίνο]]
[[en:London]]
[[es:Londres]]
[[fa:لندن]]
[[fr:Londres]]

based on those {{London}} will have the following format:

{{LangSwitch  
 |lang={{#if:{{{1|}}}|{{{1}}}|{{int:Lang}}}}  <!-- Delete this line if used in Creator or Institution templates -->
 |en=[[:en:London|London]]
 |es=[[:es:Londres|Londres]]
 |fa=[[:fa:لندن|لندن]]
 |fr=[[:fr:Londres|Londres]]
 .......
 |default = [[London]]
}}

Where:

  1. field lang introduces optional parameter to specify language, for example {{London|pl}} will show name of London in Polish language (Londyn). If this rarely used parameter is not used than user's language will be used.
  2. fields em, es, fa, fr, etc. are language fields storing links to language specific wikipedia and names in that language
  3. field default points to Wikimedia Commons gallery, if one exist. It will be used if user's wikipedia does not have related article to lint to. If not provided than link to English wikipedia will be used.

Conversion from interlanguage links to the template in the above format can be done manually. One possible alternative is to create an excel spreadsheet to do the work.

Using excel spreadsheet to create multilingual tags[edit]

Create Interwiki spreadsheet[edit]

This will have to be done only once. Steps:

  1. Leave Column A blank for the moment
  2. Copy =CONCATENATE(" |",RIGHT(LEFT(A1,FIND(":",A1)-1),FIND(":",A1)-3),"=", "[[:",RIGHT(LEFT(A1,FIND(":",A1)-1),FIND(":",A1)-3),":",RIGHT(LEFT(A1,LEN(A1)-2),LEN(A1)-FIND(":",A1)-2),"|", RIGHT(LEFT(A1,LEN(A1)-2),LEN(A1)-FIND(":",A1)-2),"]]") to cell B1 and than copy it to the rest of column B. Likely only first 300 rows will be more than enough.

Using Interwiki spreadsheet[edit]

1. Initialize new template with

{{LangSwitch  
 |lang={{#if:{{{1|}}}|{{{1}}}|{{int:Lang}}}} 
 LINKS
 |default = [[GALLERY]]
}}<noinclude>
CATEGORIES
</noinclude>

for Location templates or with

{{LangSwitch  
 LINKS
 |default = [[GALLERY]]
}}

for Name fields in Creator or Institution templates.

2. Go to wikipedia article and click "Edit links" link in the left column on the bottom. Once on Wikidata page copy the Q code from the URL and add it to [1]

3. Copy

[[el:Λονδίνο]]
[[en:London]]
[[es:Londres]]
[[fa:لندن]]
[[fr:Londres]]
into column A of the spreadsheet and code

 |en=[[:en:London|London]]
 |es=[[:es:Londres|Londres]]
 |fa=[[:fa:لندن|لندن]]
 |fr=[[:fr:Londres|Londres]]

will show up in column B.

4. Copy code from column B into the template replacing LINKS section.

5. If you have copied interlanguage links from wikipedia article than the link to that article will be missing and will need to be added. For example English wikipedia article London does not have [[en:London]] and as a result |en=[[:en:London|London]] line will be missing from the template. It should be added manually.

6. Replace GALLERY with the name of Wikimedia Commons Gallery, or delete the line if none exist.

7. Replace CATEGORIES with appropriate categories