Public Member Functions | |
getName () | |
Gets the name of this service, for example to display it for the user. | |
getQueries (string $text, string $sourceLanguage, string $targetLanguage) | |
Get queries for this service. | |
getResultData (TranslationQueryResponse $response) | |
Get the web service specific response returned by QueryAggregator. | |
getType () | |
Returns the type of this web service. | |
__construct (string $service, array $config) | |
isSupportedLanguagePair (string $sourceLanguage, string $targetLanguage) | |
Test whether given language pair is supported by the service. | |
setLogger (LoggerInterface $logger) | |
checkTranslationServiceFailure () | |
Checks whether the service has exceeded failure count. | |
Static Public Member Functions | |
static | factory (string $serviceName, array $config) |
Get a webservice handler. | |
Protected Member Functions | |
mapCode (string $code) | |
Map a MediaWiki (almost standard) language code to the code used by the translation service. | |
doPairs () | |
Get the list of supported language pairs for the web service. | |
getQuery (string $text, string $sourceLanguage, string $targetLanguage) | |
Get the query. | |
parseResponse (TranslationQueryResponse $response) | |
Get the response. | |
getSupportedLanguagePairs () | |
wrapUntranslatable (string $text) | |
Some mangling that tries to keep some parts of the message unmangled by the translation service. | |
unwrapUntranslatable (string $text) | |
Undo the hopyfully untouched mangling done by wrapUntranslatable. | |
reportTranslationServiceFailure (string $msg) | |
Increases the failure count for this service. | |
Protected Attributes | |
$service | |
$config | |
$logger | |
$serviceFailureCount = 5 | |
$serviceFailurePeriod = 900 | |
Definition at line 25 of file TranslationWebService.php.
MediaWiki\Extension\Translate\WebService\TranslationWebService::__construct | ( | string | $service, |
array | $config ) |
Definition at line 203 of file TranslationWebService.php.
MediaWiki\Extension\Translate\WebService\TranslationWebService::checkTranslationServiceFailure | ( | ) |
Checks whether the service has exceeded failure count.
Definition at line 284 of file TranslationWebService.php.
|
abstractprotected |
Get the list of supported language pairs for the web service.
The codes should be the ones used by the service. Caching is handled by the public getSupportedLanguagePairs.
TranslationWebServiceException | |
TranslationWebServiceConfigurationException |
Reimplemented in MediaWiki\Extension\Translate\WebService\ApertiumWebService, MediaWiki\Extension\Translate\WebService\CaighdeanWebService, MediaWiki\Extension\Translate\WebService\CxserverWebService, MediaWiki\Extension\Translate\WebService\GoogleTranslateWebService, MediaWiki\Extension\Translate\WebService\MicrosoftWebService, MediaWiki\Extension\Translate\WebService\RemoteTTMServerWebService, and MediaWiki\Extension\Translate\WebService\YandexWebService.
|
static |
Get a webservice handler.
Definition at line 35 of file TranslationWebService.php.
MediaWiki\Extension\Translate\WebService\TranslationWebService::getName | ( | ) |
Gets the name of this service, for example to display it for the user.
Definition at line 98 of file TranslationWebService.php.
MediaWiki\Extension\Translate\WebService\TranslationWebService::getQueries | ( | string | $text, |
string | $sourceLanguage, | ||
string | $targetLanguage ) |
Get queries for this service.
Queries from multiple services can be collected and run asynchronously with QueryAggregator.
TranslationWebServiceConfigurationException |
Definition at line 109 of file TranslationWebService.php.
|
abstractprotected |
Get the query.
See getQueries for the public method.
string | $text | Text to translate. |
string | $sourceLanguage | Language code of the text, as used by the service. |
string | $targetLanguage | Language code of the translation, as used by the service. |
TranslationWebServiceException | |
TranslationWebServiceConfigurationException | |
TranslationWebServiceInvalidInputException |
Reimplemented in MediaWiki\Extension\Translate\WebService\ApertiumWebService, MediaWiki\Extension\Translate\WebService\CaighdeanWebService, MediaWiki\Extension\Translate\WebService\CxserverWebService, MediaWiki\Extension\Translate\WebService\GoogleTranslateWebService, MediaWiki\Extension\Translate\WebService\MicrosoftWebService, MediaWiki\Extension\Translate\WebService\RemoteTTMServerWebService, and MediaWiki\Extension\Translate\WebService\YandexWebService.
MediaWiki\Extension\Translate\WebService\TranslationWebService::getResultData | ( | TranslationQueryResponse | $response | ) |
Get the web service specific response returned by QueryAggregator.
Definition at line 129 of file TranslationWebService.php.
|
protected |
TranslationWebServiceConfigurationException |
Definition at line 225 of file TranslationWebService.php.
|
abstract |
Returns the type of this web service.
Reimplemented in MediaWiki\Extension\Translate\WebService\ApertiumWebService, MediaWiki\Extension\Translate\WebService\CaighdeanWebService, MediaWiki\Extension\Translate\WebService\CxserverWebService, MediaWiki\Extension\Translate\WebService\GoogleTranslateWebService, MediaWiki\Extension\Translate\WebService\MicrosoftWebService, MediaWiki\Extension\Translate\WebService\RemoteTTMServerWebService, and MediaWiki\Extension\Translate\WebService\YandexWebService.
MediaWiki\Extension\Translate\WebService\TranslationWebService::isSupportedLanguagePair | ( | string | $sourceLanguage, |
string | $targetLanguage ) |
Test whether given language pair is supported by the service.
TranslationWebServiceConfigurationException |
Reimplemented in MediaWiki\Extension\Translate\WebService\GoogleTranslateWebService.
Definition at line 213 of file TranslationWebService.php.
|
abstractprotected |
Map a MediaWiki (almost standard) language code to the code used by the translation service.
Reimplemented in MediaWiki\Extension\Translate\WebService\ApertiumWebService, MediaWiki\Extension\Translate\WebService\CaighdeanWebService, MediaWiki\Extension\Translate\WebService\CxserverWebService, MediaWiki\Extension\Translate\WebService\GoogleTranslateWebService, MediaWiki\Extension\Translate\WebService\MicrosoftWebService, MediaWiki\Extension\Translate\WebService\RemoteTTMServerWebService, and MediaWiki\Extension\Translate\WebService\YandexWebService.
|
abstractprotected |
Get the response.
See getResultData for the public method.
TranslationWebServiceException |
Reimplemented in MediaWiki\Extension\Translate\WebService\CaighdeanWebService, MediaWiki\Extension\Translate\WebService\MicrosoftWebService, MediaWiki\Extension\Translate\WebService\RemoteTTMServerWebService, MediaWiki\Extension\Translate\WebService\ApertiumWebService, MediaWiki\Extension\Translate\WebService\CxserverWebService, MediaWiki\Extension\Translate\WebService\GoogleTranslateWebService, and MediaWiki\Extension\Translate\WebService\YandexWebService.
|
protected |
Increases the failure count for this service.
Definition at line 319 of file TranslationWebService.php.
MediaWiki\Extension\Translate\WebService\TranslationWebService::setLogger | ( | LoggerInterface | $logger | ) |
Definition at line 268 of file TranslationWebService.php.
|
protected |
Undo the hopyfully untouched mangling done by wrapUntranslatable.
Reimplemented in MediaWiki\Extension\Translate\WebService\MicrosoftWebService.
Definition at line 260 of file TranslationWebService.php.
|
protected |
Some mangling that tries to keep some parts of the message unmangled by the translation service.
Most of them support either class=notranslate or translate=no.
Reimplemented in MediaWiki\Extension\Translate\WebService\MicrosoftWebService, and MediaWiki\Extension\Translate\WebService\MintCxserverWebService.
Definition at line 252 of file TranslationWebService.php.
|
protected |
Definition at line 199 of file TranslationWebService.php.
|
protected |
Definition at line 201 of file TranslationWebService.php.
|
protected |
Definition at line 197 of file TranslationWebService.php.
|
protected |
Definition at line 276 of file TranslationWebService.php.
|
protected |
Definition at line 281 of file TranslationWebService.php.