Update for API error i18n

See Iae0e2ce3. Since Echo master requires core master, this just depends
on the master patch instead of trying to maintain BC.

Depends-On: Iae0e2ce3bd42dd4776a9779664086119ac188412
Change-Id: Icc088b31bc99e03ac88dfb44329df55318bf99b5
This commit is contained in:
Brad Jorsch 2016-11-03 15:16:56 -04:00
parent 1a0693d737
commit f608d73287
6 changed files with 16 additions and 20 deletions

View file

@ -272,5 +272,8 @@
"apihelp-query+unreadnotificationpages-param-grouppages": "Group talk pages together with their subject page, and group notifications not associated with a page together with the current user's user page.", "apihelp-query+unreadnotificationpages-param-grouppages": "Group talk pages together with their subject page, and group notifications not associated with a page together with the current user's user page.",
"apihelp-query+unreadnotificationpages-param-limit": "The maximum number of pages to return.", "apihelp-query+unreadnotificationpages-param-limit": "The maximum number of pages to return.",
"apihelp-query+unreadnotificationpages-param-wikis": "List of wikis to fetch pages with unread notifications from (defaults to only current wiki).", "apihelp-query+unreadnotificationpages-param-wikis": "List of wikis to fetch pages with unread notifications from (defaults to only current wiki).",
"apihelp-query+unreadnotificationpages-example-1": "List pages with (their amount of) unread notifications" "apihelp-query+unreadnotificationpages-example-1": "List pages with (their amount of) unread notifications",
"apiwarn-echo-deprecation-timestampformat": "The MW timestamp output format is deprecated here. In the future, ISO 8601 will always be used for the output timestamp format. Adjust your client and set <var>timestampFormat</var> to <kbd>ISO_8601</kbd>.",
"apiwarn-echo-deprecation-flyout": "<kbd>notformat=flyout</kbd> has been deprecated and will be removed soon. Use <kbd>notformat=model</kbd> to get the raw data or <kbd>notformat=special</kbd> for pre-rendered HTML.",
"apiwarn-echo-deprecation-html": "<kbd>notformat=html</kbd> has been deprecated and will be removed soon. Use <kbd>notformat=special</kbd> instead."
} }

View file

@ -265,5 +265,8 @@
"apihelp-query+unreadnotificationpages-param-grouppages": "{{doc-apihelp-param|query+unreadnotificationpages|grouppages}}", "apihelp-query+unreadnotificationpages-param-grouppages": "{{doc-apihelp-param|query+unreadnotificationpages|grouppages}}",
"apihelp-query+unreadnotificationpages-param-limit": "{{doc-apihelp-param|query+unreadnotificationpages|limit}}", "apihelp-query+unreadnotificationpages-param-limit": "{{doc-apihelp-param|query+unreadnotificationpages|limit}}",
"apihelp-query+unreadnotificationpages-param-wikis": "{{doc-apihelp-param|query+unreadnotificationpages|wikis}}", "apihelp-query+unreadnotificationpages-param-wikis": "{{doc-apihelp-param|query+unreadnotificationpages|wikis}}",
"apihelp-query+unreadnotificationpages-example-1": "{{doc-apihelp-example|query+unreadnotificationpages}}" "apihelp-query+unreadnotificationpages-example-1": "{{doc-apihelp-example|query+unreadnotificationpages}}",
"apiwarn-echo-deprecation-flyout": "{{doc-apierror}}",
"apiwarn-echo-deprecation-html": "{{doc-apierror}}",
"apiwarn-echo-deprecation-timestampformat": "{{doc-apierror}}"
} }

View file

@ -8,7 +8,7 @@ class ApiEchoMarkRead extends ApiBase {
$user = $this->getUser(); $user = $this->getUser();
if ( $user->isAnon() ) { if ( $user->isAnon() ) {
$this->dieUsage( 'Login is required', 'login-required' ); $this->dieWithError( 'apierror-mustbeloggedin-generic', 'login-required' );
} }
$notifUser = MWEchoNotifUser::newFromUser( $user ); $notifUser = MWEchoNotifUser::newFromUser( $user );

View file

@ -8,7 +8,7 @@ class ApiEchoMarkSeen extends ApiBase {
$user = $this->getUser(); $user = $this->getUser();
if ( $user->isAnon() ) { if ( $user->isAnon() ) {
$this->dieUsage( 'Login is required', 'login-required' ); $this->dieWithError( 'apierror-mustbeloggedin-generic', 'login-required' );
} }
$params = $this->extractRequestParams(); $params = $this->extractRequestParams();
@ -20,10 +20,7 @@ class ApiEchoMarkSeen extends ApiBase {
$outputTimestamp = wfTimestamp( TS_ISO_8601, $timestamp ); $outputTimestamp = wfTimestamp( TS_ISO_8601, $timestamp );
} else { } else {
// MW // MW
$this->setWarning( 'The MW timestamp output format is deprecated' . $this->addDeprecation( 'apiwarn-echo-deprecation-timestampformat' );
' here. In the future, ISO 8601 will always be used for ' .
'the output timestamp format. Adjust your client and ' .
'set timestampFormat to \'ISO_8601\'.' );
$outputTimestamp = $timestamp; $outputTimestamp = $timestamp;
} }

View file

@ -16,23 +16,16 @@ class ApiEchoNotifications extends ApiCrossWikiBase {
$this->getMain()->getVal( '_' ); $this->getMain()->getVal( '_' );
if ( $this->getUser()->isAnon() ) { if ( $this->getUser()->isAnon() ) {
$this->dieUsage( 'Login is required', 'login-required' ); $this->dieWithError( 'apierror-mustbeloggedin-generic', 'login-required' );
} }
$params = $this->extractRequestParams(); $params = $this->extractRequestParams();
/* @deprecated */ /* @deprecated */
if ( $params['format'] === 'flyout' ) { if ( $params['format'] === 'flyout' ) {
$this->setWarning( $this->addDeprecation( 'apiwarn-echo-deprecation-flyout' );
"notformat=flyout has been deprecated and will be removed soon.\n".
"Use notformat=model to get the raw data or notformat=special\n".
"for pre-rendered HTML."
);
} elseif ( $params['format'] === 'html' ) { } elseif ( $params['format'] === 'html' ) {
$this->setWarning( $this->addDeprecation( 'apiwarn-echo-deprecation-html' );
"notformat=html has been deprecated and will be removed soon.\n".
"Use notformat=special instead."
);
} }
if ( $this->allowCrossWikiNotifications() ) { if ( $this->allowCrossWikiNotifications() ) {

View file

@ -15,14 +15,14 @@ class ApiEchoUnreadNotificationPages extends ApiCrossWikiBase {
} }
/** /**
* @throws UsageException * @throws ApiUsageException
*/ */
public function execute() { public function execute() {
// To avoid API warning, register the parameter used to bust browser cache // To avoid API warning, register the parameter used to bust browser cache
$this->getMain()->getVal( '_' ); $this->getMain()->getVal( '_' );
if ( $this->getUser()->isAnon() ) { if ( $this->getUser()->isAnon() ) {
$this->dieUsage( 'Login is required', 'login-required' ); $this->dieWithError( 'apierror-mustbeloggedin-generic', 'login-required' );
} }
$params = $this->extractRequestParams(); $params = $this->extractRequestParams();