API: Make uselang=user the default
After consultation, it is thought that the reduced cacheability won't be an issue. This also adds "uselang=content" as an option since it's no longer the default. Change-Id: Idc24bfc8bff7392c2047a6b856760ad26a4e9800
This commit is contained in:
parent
f90b34cee8
commit
d0cb475f1e
3 changed files with 8 additions and 8 deletions
|
|
@ -76,10 +76,9 @@ production.
|
|||
* 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.
|
||||
|
|
|
|||
|
|
@ -192,6 +192,9 @@ class ApiMain extends ApiBase {
|
|||
$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 );
|
||||
|
|
@ -1121,8 +1124,6 @@ class ApiMain extends ApiBase {
|
|||
* @return array
|
||||
*/
|
||||
public function getAllowedParams() {
|
||||
global $wgContLang;
|
||||
|
||||
return array(
|
||||
'action' => array(
|
||||
ApiBase::PARAM_DFLT => 'help',
|
||||
|
|
@ -1151,7 +1152,7 @@ class ApiMain extends ApiBase {
|
|||
'curtimestamp' => false,
|
||||
'origin' => null,
|
||||
'uselang' => array(
|
||||
ApiBase::PARAM_DFLT => $wgContLang->getCode(),
|
||||
ApiBase::PARAM_DFLT => 'user',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
"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.",
|
||||
|
|
|
|||
Loading…
Reference in a new issue