r101799 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101798‎ | r101799 | r101800 >
Date:09:20, 3 November 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
Improvements to r100413 based on code review feedback
* fail function
* new api error messages, registering misisng messages
Modified paths:
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/resources/ext.translate.messagetable.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Translate.php
@@ -189,6 +189,9 @@
190190 'translate-messagereview-done',
191191 'translate-messagereview-apierror-invalidrevision',
192192 'translate-messagereview-apierror-unknownmessage',
 193+ 'translate-messagereview-apierror-badtoken',
 194+ 'translate-messagereview-apierror-fuzzymessage',
 195+ 'translate-messagereview-apierror-owntranslation',
193196 ),
194197 ) + $resourcePaths;
195198
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -377,7 +377,8 @@
378378 'translate-messagereview-apierror-invalidrevision' => 'Translation was not found',
379379 'translate-messagereview-apierror-unknownmessage' => 'Message was not found',
380380 'translate-messagereview-apierror-fuzzymessage' => 'Translation is marked as fuzzy',
381 - 'translate-messagereview-apierror-owntranslation' => 'You cannot accept your own translations.',
 381+ 'translate-messagereview-apierror-owntranslation' => 'You cannot accept your own translations',
 382+ 'translate-messagereview-apierror-badtoken' => 'Invalid token',
382383 'translate-messagereview-reviews' => 'Accepted by {{PLURAL:$1|one user|$1 users}}',
383384 'translate-messagereview-reviewswithyou' => 'Accepted by {{PLURAL:$1|one user|$1 users}} including you',
384385 'translate-messagereview-reviewsyou' => 'Accepted by you',
Index: trunk/extensions/Translate/resources/ext.translate.messagetable.js
@@ -1,27 +1,28 @@
2 -jQuery( document ).ready( function( $ ) {
3 - var $buttons = $( ".mw-translate-messagereviewbutton" );
4 - $buttons.each( function() {
 2+jQuery( function( $ ) {
 3+ $( ".mw-translate-messagereviewbutton" ).click( function() {
54 var $b = $(this);
6 - $b.click( function() {
7 - var successFunction = function( data, textStatus ) {
8 - if ( data.error ) {
9 - var reason = mw.msg( "translate-messagereview-apierror-" + data.error.code );
10 - $b.val( mw.msg( "translate-messagereview-failure", reason ) );
11 - } else {
12 - $b.val( mw.msg( "translate-messagereview-done" ) );
13 - }
14 - };
155
16 - var params = {
17 - action: "translationreview",
18 - token: $b.data( "token" ),
19 - revision: $b.data( "revision" ),
20 - format: "json"
21 - };
22 - $b.val( mw.msg( "translate-messagereview-progress" ) );
23 - $b.prop( "disabled", true );
24 - $.post( mw.util.wikiScript( "api" ), params, successFunction );
 6+ var successFunction = function( data, textStatus ) {
 7+ if ( data.error ) {
 8+ var reason = mw.msg( "translate-messagereview-apierror-" + data.error.code );
 9+ $b.val( mw.msg( "translate-messagereview-failure", reason ) );
 10+ } else {
 11+ $b.val( mw.msg( "translate-messagereview-done" ) );
 12+ }
 13+ };
 14+
 15+ var failFunction = function( jqXHR, textStatus ) {
 16+ $b.val( mw.msg( "translate-messagereview-failure", jqXHR.statusText ) );
 17+ };
2518
26 - } );
 19+ var params = {
 20+ action: "translationreview",
 21+ token: $b.data( "token" ),
 22+ revision: $b.data( "revision" ),
 23+ format: "json"
 24+ };
 25+ $b.val( mw.msg( "translate-messagereview-progress" ) );
 26+ $b.prop( "disabled", true );
 27+ $.post( mw.util.wikiScript( "api" ), params, successFunction ).fail( failFunction );
2728 } );
2829 } );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r100413Added a forgotten file...nikerabbit06:04, 21 October 2011

Status & tagging log