diff options
author | Brad Jorsch <bjorsch@wikimedia.org> | 2014-09-18 13:38:23 -0400 |
---|---|---|
committer | Brad Jorsch <bjorsch@wikimedia.org> | 2014-10-20 16:56:35 -0400 |
commit | ad225f501c095a154bf015978e0c3263f0f1fa3f (patch) | |
tree | b51b10c8a913068786ac0194a5d82a105fc44c7f /includes/api/ApiFeedWatchlist.php | |
parent | 015ad5d4030e553055d28d929743e49308fb459f (diff) | |
download | mediawikicore-ad225f501c095a154bf015978e0c3263f0f1fa3f.tar.gz mediawikicore-ad225f501c095a154bf015978e0c3263f0f1fa3f.zip |
API: Internationalize all remaining core API modules
This also adds some new ApiBase::PARAM_* constants to generate more
helpful help, and a method to override the default description message
for the use of ApiDisabled and ApiQueryDisabled.
Bug: 71638
Change-Id: Ic0c3d232e0498d58a043037e2e0c6f0b1c3edad3
Diffstat (limited to 'includes/api/ApiFeedWatchlist.php')
-rw-r--r-- | includes/api/ApiFeedWatchlist.php | 62 |
1 files changed, 27 insertions, 35 deletions
diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index 6aef8fc29462..84ee228ca230 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -219,50 +219,42 @@ class ApiFeedWatchlist extends ApiBase { ), 'linktosections' => false, ); + + $copyParams = array( + 'allrev' => 'allrev', + 'owner' => 'wlowner', + 'token' => 'wltoken', + 'show' => 'wlshow', + 'type' => 'wltype', + 'excludeuser' => 'wlexcludeuser', + ); if ( $flags ) { $wlparams = $this->getWatchlistModule()->getAllowedParams( $flags ); - $ret['allrev'] = $wlparams['allrev']; - $ret['wlowner'] = $wlparams['owner']; - $ret['wltoken'] = $wlparams['token']; - $ret['wlshow'] = $wlparams['show']; - $ret['wltype'] = $wlparams['type']; - $ret['wlexcludeuser'] = $wlparams['excludeuser']; + foreach ( $copyParams as $from => $to ) { + $p = $wlparams[$from]; + if ( !is_array( $p ) ) { + $p = array( ApiBase::PARAM_DFLT => $p ); + } + if ( !isset( $p[ApiBase::PARAM_HELP_MSG] ) ) { + $p[ApiBase::PARAM_HELP_MSG] = "apihelp-query+watchlist-param-$from"; + } + $ret[$to] = $p; + } } else { - $ret['allrev'] = null; - $ret['wlowner'] = null; - $ret['wltoken'] = null; - $ret['wlshow'] = null; - $ret['wltype'] = null; - $ret['wlexcludeuser'] = null; + foreach ( $copyParams as $from => $to ) { + $ret[$to] = null; + } } return $ret; } - public function getParamDescription() { - $wldescr = $this->getWatchlistModule()->getParamDescription(); - - return array( - 'feedformat' => 'The format of the feed', - 'hours' => 'List pages modified within this many hours from now', - 'linktosections' => 'Link directly to changed sections if possible', - 'allrev' => $wldescr['allrev'], - 'wlowner' => $wldescr['owner'], - 'wltoken' => $wldescr['token'], - 'wlshow' => $wldescr['show'], - 'wltype' => $wldescr['type'], - 'wlexcludeuser' => $wldescr['excludeuser'], - ); - } - - public function getDescription() { - return 'Returns a watchlist feed.'; - } - - public function getExamples() { + public function getExamplesMessages() { return array( - 'api.php?action=feedwatchlist', - 'api.php?action=feedwatchlist&allrev=&hours=6' + 'action=feedwatchlist' + => 'apihelp-feedwatchlist-example-default', + 'action=feedwatchlist&allrev=&hours=6' + => 'apihelp-feedwatchlist-example-all6hrs', ); } |