User:Mathglot/sandbox/Test pages/Expand language display customization

Ideas and proof of concept for customizing the display of the {{Expand language}} template on article pages.

Background edit

The result of this Tfd about Template:Expand language was 'keep' i.e., don't move it to the talk page. But, it was clear from the comments that some users would prefer to have the template at the bottom of the page, while others were more or less okay with it at the top, but found it too obtrusive and would seek to minimize it somehow. Some preferred to do away with it entirely.

Intro edit

This is a proof-of-concept attempt, to see what, if anything can be done to satisfy these users, without changing the default or in any way undoing or modifying the 'status quo' result of the Tfd. Looking at the Tfd comments, we can extrapolate the the following possible objectives:

  1. make the template less obtrusive
  2. move the template to the bottom of the page
  3. do not display the template from the page

I found that through code changes and appropriate use of common.css, it's possible to achieve any of these goals by opt-in features not affecting anyone else:

  • Reduce the box height, to make it less obtrusive, by:
    • changing font size and image size slightly.
    • making the box wider, so text doesn't wrap to a second line in some cases
    • dropping text (notably: 'click show to view important translation instructions')
  • Move the box to the bottom of the page.
  • Make the box disappear.

Approaches edit

The approach I'm looking into involves some transparent code changes and some css:

  • modify the code to add additional css classes as needed to implement the goals above
  • define some css style that can be used in common.css in order to opt in to various customizations, as desired

Another approach, might have been to include the style directly in the template itself, under control of some new parameter. This might be possible, but it doesn't seem in keeping with how other templates are created and used, and since common.css (and common.js) are provided by default to users and can be, and are used for all sorts of style customizations, this seemed like the right place to try to achieve the goals.

Proof of concept implementation edit

Implementation involve a two-prong approach:

  • initial proof of concept – using one or two daughter templates, so that, say, "Expand French" can be customized
  • expansion to include direct use of {{Expand language}} in articles, in a customizable fashion.

This can be done by introducing new css classes to the <table> element generated by {{Ambox}}. For objectives 1 (less obtrusive) and 3 (remove), only one class is needed, but for objective 2 (move to bottom) two classes are needed. This is because of the difference between top-of-page, article-level Expand <language> templates, of which there can be only one by definition[a] and section-level templates, of which there can be many. Only one template can be placed at the bottom of the page, because absolute positioning is used for this, so section templates should not be moved,[b] only the article template should be, if the user opts in for that.

Use of absolute positioning edit

Use of absolute positioning is part of the proof of concept, just to see if opt-in move is possible, but it isn't a permanent solution. If other templates tried to implement the same thing, they could interfere with each other, each one trying to "claim" the bottom spot. If the initial concept works, then a more permanent solution would require use of common.js to insert the html of the box near the #footer, maintaining relative positioning, rather than just overlay it on top of whatever was already there with absolute positioning. This would allow moving any number of templates, which would stack up at the bottom without impacting each other.

On the other hand, if "moving to the bottom" was only a compromise offer by those who would rather see the box eliminated entirely, and there aren't many who actually want to see it at the bottom of the page, then this whole problem just goes away. The point of absolute positioning in the initial approach was just to see if it could be done at all, and it can be.

Box classes edit

Template {{Expand French}} (like all other "Expand" templates) currently generates these classes in the <table> element:

  • box-Expand_language
  • plainlinks
  • metadata
  • ambox
  • ambox-notice

We

Testing edit

Choosing French as the initial language, here are some articles that use {{Expand French}}:

See also edit

Notes edit

  1. ^ If there are two stacked templates at the top, say, one for French, and one for German, only one of them (the second one) could be shown at the bottom of the page. But there shouldn't be two, because the case of multiple Expand templates is exactly the case where the user should be using the direct invocation of {{Expand language}} with multiple languages and articles, and not the daughter templates individually.
  2. ^ attempting to move section templates, if there were more than one, would run into the same problem, and only the last one would be visible.