r105027 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105026‎ | r105027 | r105028 >
Date:23:39, 2 December 2011
Author:gregchiasson
Status:resolved (Comments)
Tags:
Comment:
Translation/localization improvements on AFTv5. Not perfect yet, but improved.
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/SpecialArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiViewRatingsArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php
@@ -9,6 +9,18 @@
1010 * @author Arthur Richards
1111 */
1212 $messages['en'] = array(
 13+ 'articlefeedbackv5-abuse-saved' => 'Abuse flag saved',
 14+ 'articlefeedbackv5-hide-saved' => 'Hide flag saved',
 15+ 'articlefeedbackv5-error-loading-feedback' => 'Error loading Feedback',
 16+ 'articlefeedbackv5-invalid-feedback-id' => 'Invalid feedback ID',
 17+ 'articlefeedbackv5-invalid-feedback-flag' => 'Invalid feedback flag',
 18+ 'articlefeedbackv5-go-to-article' => 'Go to Article',
 19+ 'articlefeedbackv5-discussion-page' => 'Discussion Page',
 20+ 'articlefeedbackv5-whats-this' => 'What\'s this?',
 21+ 'articlefeedbackv5-invalid-page-id' => 'Invalid page ID',
 22+ 'articlefeedbackv5-percent-found' => '$1% of users found what they were looking for.',
 23+ 'articlefeedbackv5-overall-rating' => 'Rating: $1/5',
 24+ 'articlefeedbackv5-special-title' => '==Feedback==',
1325 'articlefeedbackv5' => 'Article feedback dashboard',
1426 'articlefeedbackv5-desc' => 'Article feedback',
1527
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js
@@ -66,7 +66,7 @@
6767 'success': function ( data ) {
6868 // TODO check output and error if needed
6969 $( '#aft5-' + type + '-link-' + id ).html(
70 - type + ' flag saved'
 70+ mw.msg( 'articlefeedbackv5-' + type + '-saved' )
7171 );
7272 }
7373 // TODO have a callback for failures.
@@ -104,7 +104,7 @@
105105 }
106106
107107 } else {
108 - // TODO: have error message
 108+ $( '#aft5-show-feedback' ).html( mw.msg( 'articlefeedbackv5-error-loading-feedback' ) );
109109 }
110110 }
111111 // TODO: have a callback for failures.
Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php
@@ -28,7 +28,7 @@
2929
3030 if ( !isset( $params['feedbackid'] )
3131 || !preg_match( '/^\d+$/', $params['feedbackid'] ) ) {
32 - $error = 'Invalid feedback ID format.';
 32+ $error = wfMsg( 'articlefeedbackv5-invalid-feedback-id' );
3333 }
3434
3535 # load feedback record, bail if we don't have one
@@ -40,13 +40,13 @@
4141
4242 if ( !$record->af_id ) {
4343 // no-op, because this is already broken
44 - $error = 'Invalid feedback ID.';
 44+ $error = wfMsg( 'articlefeedbackv5-invalid-feedback-id' );
4545 } elseif ( $params['flagtype'] == 'abuse' ) {
4646 $update['af_abuse_count'] = $record->af_abuse_count + 1;
4747 } elseif ( $params['flagtype'] == 'hide' ) {
4848 $update['af_hide_count'] = $record->af_hide_count + 1;
4949 } else {
50 - $error = 'Invalid flag type.';
 50+ $error = wfMsg( 'articlefeedbackv5-invalid-feedback-flag' );
5151 }
5252
5353 if ( !$error ) {
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewRatingsArticleFeedbackv5.php
@@ -98,7 +98,6 @@
9999 }
100100 $where[$prefix . '_page_id'] = $pageId;
101101 $where[] = $prefix . '_rating_id = afi_id';
102 -# $where['afi_bucket_id'] = 5; // TODO: Pass this in
103102
104103 $rows = $dbr->select(
105104 array( 'aft_' . $table, 'aft_article_field' ),
Index: trunk/extensions/ArticleFeedbackv5/SpecialArticleFeedbackv5.php
@@ -9,38 +9,36 @@
1010 public function execute( $title ) {
1111 global $wgOut;
1212 $pageId = $this->pageIdFromTitle( $title );
13 -
14 - if( !$pageId ) {
15 - # Probably this is bad.
16 - print "That ain't no good kind of page.";
17 - die();
18 - }
19 -
20 - $wgOut->setPagetitle( "Feedback for $title" );
21 -# $wgOut->addModules( 'jquery.articleFeedbackv5.special' );
22 -
2313 $this->api = $this->getApi();
24 - $output = '';
2514 $ratings = $this->api->fetchOverallRating( $pageId );
2615 $found = isset( $ratings['found'] ) ? $ratings['found'] : null;
2716 $rating = isset( $ratings['rating'] ) ? $ratings['rating'] : null;
2817
29 - $output .= "[[Wikipedia:$title|Go to Article]]
30 - | [[Wikipedia:$title|Discussion page]]
31 - | [[Wikipedia:$title|What's this?]]\n";
 18+ $wgOut->setPagetitle( "Feedback for $title" );
3219
 20+ if( !$pageId ) {
 21+ $wgOut->addWikiMsg( 'articlefeedbackv5-invalid-page-id' );
 22+ } else {
 23+ $wgOut->addWikiText(
 24+ "[[Wikipedia:$title|"
 25+ .wfMsg('articlefeedbackv5-go-to-article')."]]
 26+ | [[Wikipedia:$title|"
 27+ .wfMsg('articlefeedbackv5-discussion-page')."]]
 28+ | [[Wikipedia:$title|"
 29+ .wfMsg('articlefeedbackv5-whats-this')."]]"
 30+ );
 31+ }
 32+
3333 if( $found ) {
34 - $output .= " $found% of users found what they were looking for. ";
 34+ $wgOut->addWikiMsg( 'articlefeedbackv5-percent-found', $found );
3535 }
3636
3737 if( $rating ) {
38 - $output .= " Rating: $rating/5 ";
 38+ $wgOut->addWikiMsg( 'articlefeedbackv5-overall-rating', $rating);
3939 }
4040
41 - $output .= "\n== Feedback ==\n";
 41+ $wgOut->addWikiMsg( 'articlefeedbackv5-special-title' );
4242
43 - $wgOut->addWikiText( $output );
44 -
4543 $wgOut->addHTML(<<<EOH
4644 <!-- This is a terrible, terrible hack. I'm taking it out as soon as I stop
4745 being an idiot and sort this ResourceLoader thing out -->

Follow-up revisions

RevisionCommit summaryAuthorDate
r108144Special:ArticleFeedbackv5 page title now translatable...hashar15:31, 5 January 2012

Comments

#Comment by Johnduhart (talk | contribs)   04:41, 2 January 2012
+		$wgOut->setPagetitle( "Feedback for $title" );

Not localized.

Status & tagging log