Apps-android-commons: Add text field to media details view for users to copy image template into Wikipedia

Created on 20 Aug 2018  ·  7Comments  ·  Source: commons-app/apps-android-commons

As posted on FB,

it occurred me to directly try to use an uploaded image to an article in wp
And when I tailored on the image I saw all the details... Plus a "nominate for deletion" option, but no "use this file"
Wouldn't it be a good idea to have an automatically generated string [[file:... |right|thumb|description]] that will make the use of uploaded images through the app easier?
Maybe even two more fields for project (like "bg.wp" for Bulgarian Wikipedia (search suggest?) and another field for the article name.
In this way with the wiki code the user will be able to have the desired article opened in edit mode and just locate the place where to add the image uploaded through the app

We can just add this as one of the items in media details view I guess, along with categories, desc, etc. Could have a button at the side of the field where, when tapped, will copy the wikicode to clipboard along with a toast. Should be fairly straightforward to implement.

assigned enhancement good first issue

All 7 comments

May I pick this up?

@albendz Yes sure :-)

Here is how it is implemented in the website's Upload Wizard, if I understand correctly:

https://github.com/wikimedia/mediawiki-extensions-UploadWizard/blob/bde7469f4ac267647dd9ce9ec43d26b83fcfddd8/resources/ui/steps/uw.ui.Thanks.js#L105

        thumbWikiText = '[[' + [
            upload.details.getTitle().getPrefixedText(),
            'thumb',
            upload.details.getThumbnailCaption()
        ].join( '|' ) + ']]';

Strangely there does not seem to be any internationalization. Internationalization seems to be needed, though, here are a few examples:

  • wp.en: [[File:Lallemand - Arrestation du gouverneur de la Bastille - 1790.jpg|thumb|right|The storming of the [[Bastille]] on 14 July 1789, by [[Jean-Baptiste Lallemand]], ([[Musée de la Révolution française]])]]
  • wp.fr: [[Fichier:Le tramway - Flickr - besopha.jpg|vignette|La ligne 3a du tramway.]]
  • wp.ja: [[File:Thermes-de-Cluny-caldarium.jpg|thumb|200px|国立中世博物館に残るクリュニー浴場の[[カルダリウム]]]]
  • wp.ar:[[ملف:François-Louis Dejuinne (1786-1844) - Clovis roi des Francs (465-511).jpg|thumb|upright|left|[[كلوفيس الأول]], أول ملوك سلالة [[ميروفنجيون]].]]
  • wv.en:[[File:SIEL - RER B - Prochains trains.JPG|thumb|Next trains on RER B]]
  • wv.hi:[[चित्र:Paris,_France.jpg|अंगूठाकार|259x259पिक्सेल|पेरिस और सेन नदी]]
  • etc, anyone feel free to add more

@nicolas-raoul Regarding the internationalization, can you explain more what you expect vs. what you see? It's hard to tell from the examples what is expected. I can see for:

wp.en: [[File:Lallemand - Arrestation du gouverneur de la Bastille - 1790.jpg|thumb|right|The storming of the [[Bastille]] on 14 July 1789, by [[Jean-Baptiste Lallemand]], ([[Musée de la Révolution française]])]]

Half is in French and half in English but I am not sure what the expected is supposed to look like. Since a lot of the content is user provided, should it be localized?

Finally, is the internationalization issue part of this bug or should I only focus on generating the snippet to make it easy to paste the image into Wikipedia? (I am assuming 'wp' is Wikipedia from the original description.)

@albendz At first, you can just focus on wp.en
Your task is just to take the filename and title from the media in question, and show a copyable textbox with this text:

[[File:XXX|thumb|right|YYY]]

where XXX is the filename and YYY is the title

Good news: The English syntax works in the French and Japanese wikis, so probably in all others too, which means we only need the syntax seen in my comment above.

Actually, the upload wizard shows the English syntax even for a picture I uploaded 100% using the interface in French:
screenshot from 2018-08-22 21-24-12

Thank you for the clarification. I'll get started.

Was this page helpful?
0 / 5 - 0 ratings