MediaWiki talk:Gadget-MyUploads.js/Archive 1

portlet names from en:Wikipedia:Catalogue_of_CSS_classes

Some issues

  1. addOnloadHook is deprecated. mw:RL/JD#addOnloadHook Just have a look at MediaWiki:Common.js
  2. No i18n. There is no way of i18n the link.
  3. linkTooltip. Should be explanative, not just the same.
  4. Missing Maintainer. Please add yourself as the maintainer as done in common.js

-- RE rillke questions? 08:34, 23 August 2011 (UTC)

  Done all of the above. Thanks. Rd232 (talk) 00:29, 24 August 2011 (UTC)

Thanks, too. -- RE rillke questions? 08:46, 24 August 2011 (UTC)
  1. Don't include this link for IPs (mw.user.name() may help to check).
  2. Maybe use an icon for small screens (screen.width) instead of text?

Here is a list of posseble candidates:                      

I would prefer  . -- RE rillke questions? 08:46, 24 August 2011 (UTC)

Thanks, good point about anons; I borrowed the anonymous checking function used in Common.js. About small screens; for the moment, there is the gadget to turn off the link and get back to the status quo ante. Replacing one link with an icon will look odd, and doing so automatically not a good idea. I think if iconifying is a good idea for small screens it should be done for all the links at the top, perhaps with a separate gadget (if that's possible; bear in mind my Javascript is extremely rudimentary). Rd232 (talk) 09:02, 24 August 2011 (UTC)
Missing "," after "pt-br" @linkTooltipList. -- RE rillke questions? 20:35, 12 September 2011 (UTC)
Thanks for catching that. Rd232 (talk) 13:11, 13 September 2011 (UTC)

Localizations

Swedish

Add these text strings:

  1. 'sv': 'Mina uppladdningar',
  2. 'sv': 'Lista över filer som du har laddat upp',

Thank you! // WikiPhoenix (Talk) 17:12, 25 August 2011 (UTC)

French

  1. 'fr': 'Mes importations',
  2. 'fr': 'Liste des fichiers que vous avez importés',

Here, I chose the verb "importer" because it is how the "Upload file" link was translated in the left panel. The verb "téléverser" is sometimes used instead (e.g. on the French Wikipedia), but this word is uncommon and is not always understood. The translation of the upload wizard uses "verser", which is even worse. Unfortunately, "to upload" is hard to translate accurately in french... Here is another version with "téléverser", just in case:

  1. 'fr': 'Mes téléversements',
  2. 'fr': 'Liste des fichiers que vous avez téléversés',

Telperion (talk) 20:17, 25 August 2011 (UTC)

Spanish

  1. 'es': 'Mis archivos subidos'
  2. 'es': 'Lista de archivos que has subido'

Fitoschido [shouttrack] \\ 25 August, 2011 [23:29]

  Done Thanks for those. If you have a moment, you might also localise the Sitenotice. See MediaWiki_talk:Sitenotice#MyUploads, and post localizations at MediaWiki_talk:Sitenotice-translation#MyUploads. Thanks. Rd232 (talk) 00:04, 26 August 2011 (UTC)

Czech

  1. 'cs': 'Mé soubory'
  2. 'cs': 'Seznam vašich načtených souborů'

--kuvaly|t|c| 11:11, 26 August 2011 (UTC)

Ripuarian/Kölsch

  1. 'ksh': 'Ming Dateie'
  2. 'ksh': 'Zeisch en Leß met de Dateije, di De sellver huhjelaade häß.'

--Purodha Blissenbach (talk) 13:02, 26 August 2011 (UTC)

  Done cs and ksh. Thanks. Rd232 (talk) 18:33, 26 August 2011 (UTC)

Lëtzebuergesch

  1. 'lb': 'Meng Fichieren'
  2. 'lb': 'Lëscht vun de Fichieren, déi Dir eropgelueden hutt'

--Robby (talk) 22:52, 26 August 2011 (UTC)

Portuguese

Brazilian portuguese

  1. 'pt-br': 'Meus carregamentos'
  2. 'pt-br': 'Lista de arquivos que você carregou'

While there's no "pt" translation available, the "pt-BR" version can be used.--MisterSanderson (talk) 02:12, 27 August 2011 (UTC)

Japanese

  1. 'ja': '自分のアップロード'
  2. 'ja': '自分のアップロードしたファイルの一覧'

--Vantey (talk) 08:24, 27 August 2011 (UTC)

Chinese

Hi Rd232, here are the Chinese translations:

  • Simplified Chinese which includes zh-Hans, zh-CN, zh-MY and zh-SG
    • 我上传的文件
    • 列出您上传的所有文件
  • Traditional Chinese which includes zh, zh-Hant, zh-HK, zh-MO and zh-TW
    • 我上傳的檔案
    • 列出您上傳的所有檔案

I'm really not sure if having zh, zh-hans and zh-hant would be enough, or that we must have all the variants defined.... Regards--Ben.MQ (talk) 12:10, 27 August 2011 (UTC)

Template:GetFallback makes all Chinese variants fall back directly to zh. Right now I've just defined zh (traditional) and zh-hans (simplified). Possibly zh-cn, zh-my, zh-sg should fall back to zh-hans instead of zh, if it's available, and to zh if it's not; do you want to discuss that at COM:VP? This is exactly what {{GetFallback2}} is for, so that if the first fallback fails (i.e., in this case, there's no zh-cn message, say, but there's no zh-hans message either), it gets a different fallback (i.e. zh). Rd232 (talk) 00:03, 28 August 2011 (UTC)
I guess that should work. So far all the translated templates works fine with appropriate fallback, but when it comes to interface I was not so confident (for example CentralNotice cannot handle fallback). --Ben.MQ (talk) 06:17, 28 August 2011 (UTC)
I don't know about CentralNotice (perhaps it doesn't use {{LangSwitch}}?), but I've raised the issue at Commons:Village_pump#Chinese_variants_fallback. Rd232 (talk) 08:11, 28 August 2011 (UTC)

Dutch (nl)

  • Mijn uploads
  • Lijst van bestanden die jij hebt geüpload (literally) or Lijst van door jou geüploade bestanden (more common Dutch)

by Trijnstel -- RE rillke questions? 14:08, 27 August 2011 (UTC)

Hebrew (he)

  • My uploads - העלאות שלי
  • List of files you have uploaded - רשימת קבצים שהעלאת (Or maybe you mean her: "List of files I have uploaded" - רשימת קבצים שהעלאתי ? )

by Geagea -- RE rillke questions? 14:40, 27 August 2011 (UTC)

Ukrainian (uk)

  • My uploads — Мої завантаження
  • List of files you have uploaded — Список завантажених мною файлів

by Ahonc -- RE rillke questions? 18:27, 27 August 2011 (UTC)

Greek (el)

  • My uploads -> *Οι επιφορτώσεις μου
  • List of files you have uploaded -> *Κατάλογος των αρχείων που έχετε επιφορτώσει

by Badseed -- RE rillke questions? 20:44, 27 August 2011 (UTC)

  Done all to date. Rd232 (talk) 22:48, 27 August 2011 (UTC)

Bengali (bn)

  • "My uploads" => "আমার আপলোড"
  • "List of files you have uploaded" => "আপনার আপলোডকৃত ফাইলের তালিকা"

by Wikitanvir /replyed @my talk page. -- RE rillke questions? 08:49, 28 August 2011 (UTC)

  Done Rd232 (talk) 16:04, 28 August 2011 (UTC)

Russian (ru)

  • "My uploads" => "Мои загрзки"
  • "List of files you have uploaded" => Список загруженных вами файлов"

by--Analitic114 (talk) 16:29, 28 August 2011 (UTC)

Esperanto (eo)

  • 'My uploads' => 'Miaj alŝutoj'
  • 'List of files you have uploaded' => 'Listo de dosieroj kiujn mi alŝutis'

--Arno Lagrange 17:19, 28 August 2011 (UTC)

  Done thanks. Rd232 (talk) 23:35, 28 August 2011 (UTC)

Galician (gl)

Please add:

  • 'gl': 'As miñas cargas',
  • 'gl': 'Lista dos ficheiros que cargou',

Thanks! --Toliño Fala aquí comigo 07:47, 29 August 2011 (UTC)

  Done thanks! Rd232 (talk) 10:00, 29 August 2011 (UTC)

Catalan (ca)

  • 'ca':'Les meves càrregues
  • 'ca':'Llista de fitxers que heu carregat'

--Pere prlpz (talk) 15:24, 29 August 2011 (UTC)

  Done thanks. Rd232 (talk) 22:11, 29 August 2011 (UTC)

Finnish (fi)

  • My uploads : Omat tallennukset
  • List of files you have uploaded : Luettelo tiedostoista, jotka olet tallentanut

thanks! --Olli (talk) 06:08, 31 August 2011 (UTC)

  Done thanks. Rd232 (talk) 11:11, 1 September 2011 (UTC)

Turkish (tr)

Please add.

  • My uploads: Yüklemelerim
  • List of files you have uploaded: Yüklediğiniz dosyaların listesi

thanks! Nazif İLBEK (talk) 13:04, 13 September 2011 (UTC)   Done Rd232 (talk) 13:10, 13 September 2011 (UTC)

Albanian (sq)

  • My uploads: Ngarkimet e mia
  • List of files you have uploaded: Lista e skedave që keni ngarkuar

Thanks! Olsi (talk) 14:43, 13 September 2011 (UTC)

  Done thanks Rd232 (talk) 16:09, 13 September 2011 (UTC)

Hungarian (hu)

  • My uploads: Feltöltéseim
  • List of files you have uploaded: A feltöltött fájljaid listája

Thank you! --BáthoryPéter (talk) 17:40, 13 September 2011 (UTC)

  Done thanks. Rd232 (talk) 18:55, 13 September 2011 (UTC)

Romanian (ro)

  • 'ro': 'Încărcări', (My uploads)
  • 'ro': 'Lista fișierelor încărcate de tine', (List of files you have uploaded)

(: --ANDROBETA 19:14, 13 September 2011 (UTC)

  Done thanks Rd232 (talk) 21:50, 13 September 2011 (UTC)

Norwegian (Bokmål) (no and nb)

  • 'Egne opplastinger',
  • 'Liste over filer du har lastet opp.',

Thanks! Jon Harald Søby (talk) 17:30, 15 September 2011 (UTC)

Norwegian (Nynorsk) (nn)

  • 'Eigne opplastingar',
  • 'Liste over filer du har lasta opp.',

Thanks! Jon Harald Søby (talk) 17:30, 15 September 2011 (UTC)

  Done thanks Rd232 (talk) 19:36, 15 September 2011 (UTC)

New proposed code

Hi Rd232, again I rewrote this code and asked a code-quality tool for advice. Here is the new proposal:

/****************** MyUploads ***********************
 
  Puts a link in the upper right corner of all pages.
  This code is JSHint valid!

  Maintainer: [[User:Rd232]]
  written in 2011
*****************************************************/

/*global mw: false, jQuery: false, $: false */
/*jshint curly:false, */

(function () {
'use strict';
if (window.uploadLink || mw.user.anonymous()) return;

window.uploadLink = { // extra-object to prevent pollution of "window"
  getUserName: function () {
    var username = '';
    switch (mw.config.get('wgNamespaceNumber')) {
    case 3: // User_talk
    case 2: // User
      username = mw.config.get('wgPageName').match(/.*?\:(.*?)(\/.*)*$/)[1];
      break;
    case -1: // Special pages
      try {
        if ("Contributions" === mw.config.get('wgCanonicalSpecialPageName')) {
          if (-1 !== location.href.indexOf("\/Special:Contributions\/")) {
            username = decodeURI(location.href.match(/Special\:Contributions\/(.*?)$/)[1]);
          } else if (-1 !== location.href.indexOf(mw.config.get('wgScript'))) {
            username = mw.util.getParamValue('target');
          }
        }
        if ("Log" === mw.config.get('wgCanonicalSpecialPageName')) {
          if (mw.util.getParamValue('user')) username = mw.util.getParamValue('user');
          if (mw.util.getParamValue('page')) {
            if (/User:+./.test(mw.util.getParamValue('page'))) {
              username = mw.util.getParamValue('page').replace("User:", "");
            }
          }
        }
      } catch (ex) {}
      break;
    }
    return username;
  },
 
  install: function () {
    var link, userlink, username = encodeURI(this.getUserName());
 
    if ('en' === mw.config.get('wgUserLanguage')) {
      link = mw.config.get('wgScript') + '?title=' + 'Special:MyUploads&withJS=MediaWiki:JSONListUploads.js';
      userlink = mw.config.get('wgScript') + '?title=' + 'Special:ListFiles/' + username + '&withJS=MediaWiki:JSONListUploads.js';
    } else {
      link = mw.config.get('wgScript') + '?title=' + 'Special:MyUploads';
      userlink = mw.config.get('wgScript') + '?title=' + 'Special:ListFiles/' + username + '&withJS=MediaWiki:JSONListUploads.js';
    }
 
    var userlinkText = "User uploads"; // english only
    var linkTextList = {
      // Translations of the menu item
      i18n: {
        'bn': 'আমার আপলোড',
        'ca': 'Les meves càrregues',
        'cs': 'Mé soubory',
        'de': 'Eigene Dateien',
        'el': 'Οι επιφορτώσεις μου',
        'en': 'My uploads', // default
        'eo': 'Miaj alŝutoj',
        'es': 'Mis archivos subidos',
        'fa': '\u067e\u0631\u0648\u0646\u062f\u0647\u200c\u0647\u0627\u06cc \u0645\u0646',
        'fi': 'Omat tallennukset',
        'fr': 'Mes importations',
        'gl': 'As miñas cargas',
        'he': 'העלאות שלי',
        'hu': 'Feltöltéseim',
        'it': 'Miei caricamenti',
        'ja': '自分のアップロード',
        'ko': '내가 올린 파일',
        'ksh': 'Ming Dateie',
        'lb': 'Meng Fichieren',
        'nb': 'Egne opplastinger',
        'nl': 'Mijn uploads',
        'nn': 'Eigne opplastingar',
        'no': 'Egne opplastinger',
        'pl': 'Moje pliki',
        'pt': 'Meus carregamentos',
        'pt-br': 'Meus carregamentos',
        'ro': 'Încărcări',
        'ru': 'Мои загрзки',
        'sq': 'Ngarkimet e mia',
        'sv': 'Mina uppladdningar',
        'tr': 'Yüklemelerim',
        'uk': 'Мої завантаження',
        'zh': '我上傳的檔案',
        'zh-hans': '我上传的文件'
      }
    };
 
    var linkTooltipList = {
      // Translations of the menu item tooltip
      i18n: {
        'bn': 'আপনার আপলোডকৃত ফাইলের তালিকা',
        'ca': 'Llista de fitxers que heu carregat',
        'cs': 'Seznam vašich načtených souborů',
        'de': 'Liste der Dateien, die du hochgeladen hast',
        'el': 'Κατάλογος των αρχείων που έχετε επιφορτώσει',
        'eo': 'Listo de dosieroj kiujn mi alŝutis',
        'en': 'List of files you have uploaded', // default
        'es': 'Lista de archivos que has subido',
        'fa': '\u0641\u0647\u0631\u0633\u062a \u067e\u0631\u0648\u0646\u062f\u0647\u200c\u0647\u0627\u06cc\u06cc \u06a9\u0647 \u0628\u0627\u0631\u06af\u0630\u0627\u0631\u06cc \u06a9\u0631\u062f\u0647\u200c\u0627\u06cc\u062f',
        'fi': 'Luettelo tiedostoista, jotka olet tallentanut',
        'fr': 'Liste des fichiers que vous avez importés',
        'gl': 'Lista dos ficheiros que cargou',
        'he': 'רשימת קבצים שהעלאת',
        'hu': 'A feltöltött fájljaid listája',
        'it': 'Lista dei file che hai caricato',
        'ja': '自分のアップロードしたファイルの一覧',
        'ko': '내가 올린 파일의 목록',
        'ksh': 'Zeisch en Leß met de Dateije, di De sellver huhjelaade häß',
        'lb': 'Lëscht vun de Fichieren, déi Dir eropgelueden hutt',
        'nb': 'Liste over filer du har lastet opp.',
        'nl': 'Lijst van door jou geüploade bestanden',
        'nn': 'Liste over filer du har lasta opp.',
        'no': 'Liste over filer du har lastet opp.',
        'pl': 'Lista plików załadowanych przez Ciebie',
        'pt': 'Lista de arquivos que você carregou',
        'pt-br': 'Lista de arquivos que você carregou',
        'ro': 'Lista fișierelor încărcate de tine',
        'ru': 'Список загруженных вами файлов',
        'sq': 'Lista e skedave që keni ngarkuar',
        'sv': 'Lista över filer som du har laddat upp',
        'tr': 'Yüklediğiniz dosyaların listesi',
        'uk': 'Список завантажених мною файлів',
        'zh': '列出您上傳的所有檔案',
        'zh-hans': '列出您上传的所有文件'
      }
    };
 
    var linkText = linkTextList.i18n[mw.config.get('wgUserLanguage')] || linkTextList.i18n.en;
    var linkTooltip = linkTooltipList.i18n[mw.config.get('wgUserLanguage')] || linkTooltipList.i18n.en;
 
    mw.util.addPortletLink('p-personal', link, linkText, 'pt-upl', linkTooltip, '', document.getElementById('pt-logout'));
 
    if (username) {
      mw.util.addPortletLink('p-tb', userlink, userlinkText, 't-JSONListUploads', '', '', document.getElementById('t-log'));
    }
  } // function
}; // object

jQuery(function ($) {
  try {
    window.uploadLink.install();
  } catch (ex) {} // silently fail - it is obvious if the link is missing
});

})();
 /* End MyUploads */
Return to "Gadget-MyUploads.js/Archive 1" page.