$entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
}
}
+ if ( isset( $prop['langname'] ) ) {
+ $entry['langname'] = Language::fetchLanguageName( $row->ll_lang, $params['inlanguagecode'] );
+ }
+ if ( isset( $prop['autonym'] ) ) {
+ $entry['autonym'] = Language::fetchLanguageName( $row->ll_lang );
+ }
ApiResult::setContent( $entry, $row->ll_title );
$fit = $this->addPageSubItem( $row->ll_from, $entry );
if ( !$fit ) {
}
public function getAllowedParams() {
+ global $wgContLang;
return array(
'limit' => array(
ApiBase::PARAM_DFLT => 10,
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => array(
'url',
+ 'langname',
+ 'autonym',
)
),
'lang' => null,
'descending'
)
),
+ 'inlanguagecode' => $wgContLang->getCode(),
);
}
'url' => "Whether to get the full URL (Cannot be used with {$this->getModulePrefix()}prop)",
'prop' => array(
'Which additional properties to get for each interlanguage link',
- ' url - Adds the full URL',
+ ' url - Adds the full URL',
+ ' langname - Adds the localised language name (best effort, use CLDR extension)',
+ " Use {$this->getModulePrefix()}inlanguagecode to control the language",
+ ' autonym - Adds the native language name',
),
'lang' => 'Language code',
'title' => "Link to search for. Must be used with {$this->getModulePrefix()}lang",
'dir' => 'The direction in which to list',
+ 'inlanguagecode' => 'Language code for localised language names',
);
}
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
),
+ 'langname' => array(
+ ApiBase::PROP_TYPE => 'string',
+ ApiBase::PROP_NULLABLE => true
+ ),
+ 'autonym' => array(
+ ApiBase::PROP_TYPE => 'string',
+ ApiBase::PROP_NULLABLE => true
+ ),
'*' => 'string'
)
);