Page MenuHomePhabricator

Remove or regenerate PNG files for Translate
Closed, ResolvedPublic

Description

Per discussion from https://gerrit.wikimedia.org/r/#/c/380062/

The png files should be regenerated from the upgraded SVG files. However, these days basically all browsers that support JavaScript also support SVG. Hence, we can reduce our work by first doing an audit for which images only appear if JavaScript is enabled. This will both reduce further maintenance work as well as slim down the stylesheets.

I am adding the easy tag, even though this is not trivial:

  1. First identify in which CSS/JS/PHP files the image is referenced
  2. Those only mentioned in JS do not need PNG
  3. Those mentioned in PHP likely need PNG
  4. Those mentioned in CSS should be checked with Resources.php to find the resource modules
  5. Those resource module names can be searched again to see on which pages they are used
  6. Check those pages without JavaScript to see if some image appears without, those should keep PNG

I imagine most of these files are used on special pages such as Special:Translate and Special:AggregateGroups. Basic Translate setup is needed as documented in mediawiki.org

Event Timeline

Restricted Application added subscribers: TerraCodes, Aklapper. · View Herald TranscriptOct 18 2017, 11:26 AM
Nikerabbit added a comment.EditedOct 18 2017, 11:27 AM

This should be done in two independent steps:

  1. First remove the PNG files
  2. Then regenerate the remaining ones

There is some guidance how to generate an optimized PNG file from SVG.

MtDu added a subscriber: MtDu.Oct 22 2017, 2:09 PM

@Nikerabbit Suitable GCI task?

Not the easiest task, but should be doable in GCI.

Nikerabbit triaged this task as Low priority.Nov 30 2017, 2:18 PM
Framawiki added a subscriber: Framawiki.

Change 401658 had a related patch set uploaded (by Eflyjason; owner: Eflyjason):
[mediawiki/extensions/Translate@master] Remove or regenerate PNG files for Translate

https://gerrit.wikimedia.org/r/401658

We have to remove the .png reference from the .less/.css files right?

Yes those must be removed. I filed T179563: Lacking mixing for SVG only background images earlier to clarify how to do this. It is not yet resolved, but I suggest we just standardize on this code when PNG is not used:

  • LESS files: .background-image( '....svg' );
  • CSS files: background-image: /* @embed */ url( ....svg );

In some cases this means taking the url out of background: rule.

Change 401658 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Remove or regenerate PNG files for Translate

https://gerrit.wikimedia.org/r/401658

Nikerabbit closed this task as Resolved.Jan 4 2018, 10:38 AM
Nikerabbit removed a project: Patch-For-Review.

Change 402039 merged by Nikerabbit:
[mediawiki/extensions/Translate@master] Remove search.png for Translate

https://gerrit.wikimedia.org/r/402039