From: Federico Leva Date: Wed, 6 Nov 2013 23:08:02 +0000 (+0100) Subject: Add direct links to translation interface on Special:AllMessages X-Git-Tag: 1.31.0-rc.0~17154 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=fa5576bee539f544962f080b4b5a900e99ee7ea3;p=lhc%2Fweb%2Fwiklou.git Add direct links to translation interface on Special:AllMessages The local Special:AllMessages page is the first and most friendly place where average users will look for the message and try to translate it: when they find it, add a link to translatewiki.net so that they can start translating without searching for it from scratch. Special:SearchTranslations is the only target usable for this: the solr search is smart enough to present the most relevant results first and the translation interface is directly available in place. On the bright side, similar messages popping up from other projects or areas of the code will provide suggestions and help find other occurrences of translations which can similarly be improved. More specifically, we are using a combined language, key and text search: * the English text is the only thing guaranteed to exist, if the message is available, though quoting it can give some false negatives and not quoting it would give it too much weight if it's long; * the key can be used thanks to the feature revealed by Niklas Laxström in comments to this patch: it is simpler to handle but allows only exact matches and can be wrong if TWN adds a prefix for the extension, so it can't be used alone, but in the best case it's what we're looking for; * the language makes sense in combination with the key match. We boost key and language to get the current translation of the message where possible; if it's not, the first result will usually be English text. https://wiki.apache.org/solr/SolrQuerySyntax https://lucene.apache.org/core/2_9_4/queryparsersyntax.html From the initial search, the user can further refine its search and navigate the interface to find the message(s) and editor where to add or edit the translation. Change-Id: I8de3faba829c50cdc0f2d09726f738c585792e00 --- diff --git a/includes/specials/SpecialAllmessages.php b/includes/specials/SpecialAllmessages.php index 35d6a0c08c..71bb27a1b5 100644 --- a/includes/specials/SpecialAllmessages.php +++ b/includes/specials/SpecialAllmessages.php @@ -345,6 +345,17 @@ class AllmessagesTablePager extends TablePager { case 'am_title' : $title = Title::makeTitle( NS_MEDIAWIKI, $value . $this->suffix ); $talk = Title::makeTitle( NS_MEDIAWIKI_TALK, $value . $this->suffix ); + $translation = Linker::makeExternalLink( + 'https://translatewiki.net/w/i.php?' . wfArrayToCgi( array( + 'title' => 'Special:SearchTranslations', + 'group' => 'mediawiki', + 'grouppath' => 'mediawiki', + 'query' => 'language:' . $this->getLanguage()->getCode() . '^25 ' . + 'messageid:"MediaWiki:' . $value . '"^10 "' . + $this->msg ( $value )->inLanguage ( 'en' )->plain() . '"' + ) ), + $this->msg( 'allmessages-filter-translate' )->text() + ); if ( $this->mCurrentRow->am_customised ) { $title = Linker::linkKnown( $title, $this->getLanguage()->lcfirst( $value ) ); @@ -369,7 +380,10 @@ class AllmessagesTablePager extends TablePager { ); } - return $title . ' ' . $this->msg( 'parentheses' )->rawParams( $talk )->escaped(); + return $title . ' ' + . $this->msg( 'parentheses' )->rawParams( $talk )->escaped() + . ' ' + . $this->msg( 'parentheses' )->rawParams( $translation )->escaped(); case 'am_default' : case 'am_actual' : diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 21f73cc22b..300792ac7a 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -3557,6 +3557,7 @@ Please visit [https://www.mediawiki.org/wiki/Localisation MediaWiki Localisation 'allmessages-prefix' => 'Filter by prefix:', 'allmessages-language' => 'Language:', 'allmessages-filter-submit' => 'Go', +'allmessages-filter-translate' => 'Translate', # Thumbnails 'thumbnail-more' => 'Enlarge', diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index 746daee317..ebb470f506 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -7190,6 +7190,7 @@ See also: 'allmessages-filter-submit' => 'Used on [[Special:Allmessages]]. {{Identical|Go}}', +'allmessages-filter-translate' => 'Used on [[Special:Allmessages]]. Label for a link to translatewiki.net for a message to translate.', # Thumbnails 'thumbnail-more' => '[[Image:Yes.png|thumb|This:]] diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index ea45ee65c3..d698552274 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -2472,6 +2472,7 @@ $wgMessageStructure = array( 'allmessages-prefix', 'allmessages-language', 'allmessages-filter-submit', + 'allmessages-filter-translate', ), 'thumbnails' => array( 'thumbnail-more',