* Hitting api.php without specifying an action now displays only the help for
the main module, with links to submodule help.
* API help is no longer displayed on errors.
-* Internationalized messages returned by the API will be in the wiki's content
- language by default. 'uselang' is now a recognized API parameter;
- "uselang=user" may be used to select the language from the current user's
- preferences.
+* 'uselang' is now a recognized API parameter; "uselang=user" may be used to
+ explicitly select the language from the current user's preferences, and
+ "uselang=content" may be used to select the wiki's content language.
* Default output format for the API is now jsonfm.
* Simplified continuation will return a "batchcomplete" property in the result
when a batch of pages is complete.
$uselang = $this->getUser()->getOption( 'language' );
$uselang = RequestContext::sanitizeLangCode( $uselang );
wfRunHooks( 'UserGetLanguageObject', array( $this->getUser(), &$uselang, $this ) );
+ } elseif ( $uselang === 'content' ) {
+ global $wgContLang;
+ $uselang = $wgContLang->getCode();
}
$code = RequestContext::sanitizeLangCode( $uselang );
$this->getContext()->setLanguage( $code );
* @return array
*/
public function getAllowedParams() {
- global $wgContLang;
-
return array(
'action' => array(
ApiBase::PARAM_DFLT => 'help',
'curtimestamp' => false,
'origin' => null,
'uselang' => array(
- ApiBase::PARAM_DFLT => $wgContLang->getCode(),
+ ApiBase::PARAM_DFLT => 'user',
),
);
}
"apihelp-main-param-servedby": "Include the hostname that served the request in the results.",
"apihelp-main-param-curtimestamp": "Include the current timestamp in the result.",
"apihelp-main-param-origin": "When accessing the API using a cross-domain AJAX request (CORS), set this to the originating domain. This must be included in any pre-flight request, and therefore must be part of the request URI (not the POST body). This must match one of the origins in the Origin: header exactly, so it has to be set to something like http://en.wikipedia.org or https://meta.wikimedia.org. If this parameter does not match the Origin: header, a 403 response will be returned. If this parameter matches the Origin: header and the origin is whitelisted, an Access-Control-Allow-Origin header will be set.",
- "apihelp-main-param-uselang": "Language to use for message translations. A list of codes may be fetched from [[Special:ApiHelp/query+siteinfo|action=query&meta=siteinfo&siprop=languages]], or specify \"user\" to use the current user's language preference.",
+ "apihelp-main-param-uselang": "Language to use for message translations. A list of codes may be fetched from [[Special:ApiHelp/query+siteinfo|action=query&meta=siteinfo]] with siprop=languages, or specify \"user\" to use the current user's language preference, or specify \"content\" to use this wiki's content language.",
"apihelp-block-description": "Block a user.",
"apihelp-block-param-user": "Username, IP address or IP range you want to block.",