User:Ivanhercaz/AttributionGenerator.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/*
* User script to generate attribution of multimedia files with the Attribution Generator (Lizenzhinweisgenerator),
* a tool developed by Wikimedia Deutschland
* The tools is already available in German, English, Spanish and Portuguese.
* If you want to translate the tool to your language, you can check:
* https://commons.wikimedia.org/wiki/Commons:Attribution Generator
* If you want to improve this script with your language, you can translate the
* "lang" and "desc" variables and post them in my talk page, then I will add here.
*/
var lang = mw.config.get('wgUserLanguage');
var page = mw.util.rawurlencode( mw.config.get( 'wgPageName' ) );
var pageUrl = 'https:' + mw.config.get('wgServer') + '/wiki/' + page;
if (lang === "de") {
var tool = 'Lizenzhinweisgenerator';
var desc = 'Lizenzhinweise für Bilder aus Wikipedia und Wikimedia Commons';
} else if (lang === "en") {
var tool = 'Attribution Generator';
var desc = 'License information for images from Wikipedia and Wikimedia Commons';
} else if (lang === "es") {
var tool = 'Generador de Atribución';
var desc = 'Información de la licencia para imágenes de Wikipedia y Wikimedia Commons';
} else if (lang === "pt") {
var tool = 'Gerador de Atribuição';
var desc = 'License information for images from Wikipedia and Wikimedia Commons';
} else {
var tool = 'Attribution Generator';
var desc = 'Informação information for images from Wikipedia and Wikimedia Commons';
}
var portletLink = mw.util.addPortletLink(
'p-tb',
'https://lizenzhinweisgenerator.de/?lang=' + lang + '&url=' + pageUrl,
tool,
't-attributiongenerator',
desc
);