Last modified: 2013-10-08 12:30:43 UTC
Currently there is no way to do this. It would be nice to make it possible to do a link to http://translatewiki.net/w/i.php?title=Special%3ALanguageStats&x=D&code=qqq where it is sorted by translation coverage by default.
When permalinks are wanted we usually let the table be built with the TablePager class, which provides server-side sortability for (single or multi-page) tables. It uses query parameters in the URL to trigger which column to sort and in which direction to sort it. In JavaScript in general, and especially in jquery.tablesorter this would be kinda akward to implement. The problem starts at identifying which table is meant (since there can be multiple table.sortable elements on an article). Then how to identify which column ? Refer by number ? Currently for the on-page state an incrementing number is used to differentiate between different tables etc. however these are only to be used within a state, not in URLs to new instances/loads of the article as the numbers are likely not the same (there could be an additional table, or tables re-ordered, merged, moved etc. there is no reliable ID. Taking that the given example is a table outputted by a MediaWiki (PHP) extension, and not wikitext. Using TablePager (or a variation on it that allows GET parameters to handle the sorting) should be do-able. Alternatively you could implement a few lines of JavaScript as part of the Translate-extension listening to a value in location.hash when the page is loaded and trigger a sort. Again, I suggest to do this inside the special page or extension instead of in jquery.tablesorter as jquery.tablesorter is primarily meant for articles and needs to support multiple tables per-page. Something with $(document).ready, window.location.hash and $(find table) using $.fn.tablesorter or $.fn.click or $.fn.attr to somehow force an initial sort. -- Moving from component ResourceLoader to JavaScript (related to the jquery.tablesorter module)
TablePager would be a significant detour how I generate the table currently, and I don't need most of the stuff it does, like paging. Can't we just refer to the table with id/class?
It would be really nice to have a better way to do this. Conscientiously entering each row in alphabetical order is a bit more of an editing task. And the process to sort things afterwards seems to be rather more work than would be ideal: http://meta.wikimedia.org/wiki/Help:Sorting#Default_order Seems like this could save a lot of editors a lot of time they could instead devote to content.
FYI I implemented a custom solution for my special pages: http://translatewiki.net/w/i.php?title=Special:LanguageStats&suppresscomplete=1#sortable:2=desc I'm withdrawing this request since there doesn't seem to be interest for generic solution.
I asked Niklas about the implementation out of curiosity and got a reply: "The code is at: https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FTranslate.git/6881f09ee2e0e9ad22a404c9c07088e7afaddd4d/resources%2Fjs%2Fext.translate.special.languagestats.js#L122 Feel free to add that to the bug."