Nikerabbit has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/389481 )
Change subject: Fix log spam and exception with empty message definitions
......................................................................
Fix log spam and exception with empty message definitions
Trying to query translation memory for a message which has an empty
definition (rare but happens) resulted in an uncaught exception
and few warnings. The logical thing is to just to skip all queries
if the definition is empty and that also avoids the reported issues.
This caused all translation aids to show "Loading..." indefinitely
for those messages.
Did the same for MachineTranslation aid. Even though it was not
causing visible issues, it seemed that the CXServer backend request
was internally timing out if the definition was empty.
Bug: T166104
Change-Id: I8698cabf08f16055c45fc2e27ace5b3af54d8a0a
---
M translationaids/MachineTranslationAid.php
M translationaids/TTMServerAid.php
2 files changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate
refs/changes/81/389481/1
diff --git a/translationaids/MachineTranslationAid.php
b/translationaids/MachineTranslationAid.php
index ecd0ab8..260666e 100644
--- a/translationaids/MachineTranslationAid.php
+++ b/translationaids/MachineTranslationAid.php
@@ -21,6 +21,11 @@
$from = $this->group->getSourceLanguage();
$to = $this->handle->getCode();
+ if ( trim( $definition ) === '' ) {
+ return;
+ }
+
+
foreach ( $this->getWebServices( 'mt' ) as $service ) {
if ( $service->checkTranslationServiceFailure() ) {
continue;
diff --git a/translationaids/TTMServerAid.php b/translationaids/TTMServerAid.php
index 8a3de98..174e912 100644
--- a/translationaids/TTMServerAid.php
+++ b/translationaids/TTMServerAid.php
@@ -31,6 +31,10 @@
$from = $this->group->getSourceLanguage();
$to = $this->handle->getCode();
+ if ( trim( $text ) === '' ) {
+ return $suggestions;
+ }
+
// "Local" queries using a client can't be run in parallel with
web services
global $wgTranslateTranslationServices;
foreach ( $wgTranslateTranslationServices as $name => $config )
{
--
To view, visit https://gerrit.wikimedia.org/r/389481
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8698cabf08f16055c45fc2e27ace5b3af54d8a0a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits