summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/webservices/TranslationWebService.php')
-rw-r--r--MLEB/Translate/webservices/TranslationWebService.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/MLEB/Translate/webservices/TranslationWebService.php b/MLEB/Translate/webservices/TranslationWebService.php
index 77f0d13d..a72be868 100644
--- a/MLEB/Translate/webservices/TranslationWebService.php
+++ b/MLEB/Translate/webservices/TranslationWebService.php
@@ -93,6 +93,9 @@ abstract class TranslationWebService implements LoggerAwareInterface {
* @throws TranslationWebServiceConfigurationException
*/
public function getQueries( $text, $from, $to ) {
+ $from = $this->mapCode( $from );
+ $to = $this->mapCode( $to );
+
try {
return [ $this->getQuery( $text, $from, $to ) ];
} catch ( TranslationWebServiceException $e ) {
@@ -113,7 +116,10 @@ abstract class TranslationWebService implements LoggerAwareInterface {
*/
public function getResultData( TranslationQueryResponse $response ) {
if ( $response->getStatusCode() !== 200 ) {
- $this->reportTranslationServiceFailure( $response->getStatusMessage() );
+ $this->reportTranslationServiceFailure(
+ 'STATUS: ' . $response->getStatusMessage() . "\n" .
+ 'BODY: ' . $response->getBody()
+ );
return null;
}
@@ -191,7 +197,6 @@ abstract class TranslationWebService implements LoggerAwareInterface {
protected $config;
/**
- * TranslationWebService constructor.
* @param string $service Name of the webservice
* @param array $config
*/
@@ -211,6 +216,9 @@ abstract class TranslationWebService implements LoggerAwareInterface {
*/
public function isSupportedLanguagePair( $from, $to ) {
$pairs = $this->getSupportedLanguagePairs();
+ $from = $this->mapCode( $from );
+ $to = $this->mapCode( $to );
+
return isset( $pairs[$from][$to] );
}