diff options
Diffstat (limited to 'www/wiki/extensions/Translate/webservices/ApertiumWebService.php')
-rw-r--r-- | www/wiki/extensions/Translate/webservices/ApertiumWebService.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/www/wiki/extensions/Translate/webservices/ApertiumWebService.php b/www/wiki/extensions/Translate/webservices/ApertiumWebService.php index c813af89..d333621b 100644 --- a/www/wiki/extensions/Translate/webservices/ApertiumWebService.php +++ b/www/wiki/extensions/Translate/webservices/ApertiumWebService.php @@ -4,7 +4,7 @@ * * @file * @author Niklas Laxström - * @license GPL-2.0+ + * @license GPL-2.0-or-later */ /** @@ -19,14 +19,14 @@ class ApertiumWebService extends TranslationWebService { } protected function mapCode( $code ) { - return str_replace( '-', '_', wfBCP47( $code ) ); + return str_replace( '-', '_', LanguageCode::bcp47( $code ) ); } protected function doPairs() { - $pairs = array(); + $pairs = []; $json = Http::get( $this->config['pairs'], - array( 'timeout' => $this->config['timeout'] ), + [ 'timeout' => $this->config['timeout'] ], __METHOD__ ); $response = FormatJson::decode( $json ); @@ -47,21 +47,21 @@ class ApertiumWebService extends TranslationWebService { protected function getQuery( $text, $from, $to ) { if ( !isset( $this->config['key'] ) ) { - throw new TranslationWebServiceException( 'API key is not set' ); + throw new TranslationWebServiceConfigurationException( 'API key is not set' ); } $text = trim( $text ); $text = $this->wrapUntranslatable( $text ); - $params = array( + $params = [ 'q' => $text, 'langpair' => "$from|$to", - 'x-application' => 'Translate ' . TRANSLATE_VERSION . ')', - ); + 'x-application' => 'MediaWiki Translate extension ' . TRANSLATE_VERSION, + ]; return TranslationQuery::factory( $this->config['url'] ) ->timeout( $this->config['timeout'] ) - ->queryParamaters( $params ); + ->queryParameters( $params ); } protected function parseResponse( TranslationQueryResponse $reply ) { |